diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-05-02 23:39:11 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-05-02 23:39:11 -0400 |
commit | 62e34428d357f609be17a866638bedb45f935d8e (patch) | |
tree | e5921380a563c3d0a2fa7d1cee4524a9f26f3ad9 /src/LYBookmark.c | |
parent | 2a94396ccd9cf5ade728c53e02cba28e06af4378 (diff) | |
download | lynx-snapshots-62e34428d357f609be17a866638bedb45f935d8e.tar.gz |
snapshot of project "lynx", label v2-8-1dev_8
Diffstat (limited to 'src/LYBookmark.c')
-rw-r--r-- | src/LYBookmark.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 8416563b..21f61a14 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -484,7 +484,7 @@ PUBLIC void remove_bookmark_link ARGS2( * Explicitly preserve bookmark file mode on Unix. - DSL */ if (stat(filename_buffer, &stat_buf) == 0) { - mode = ((stat_buf.st_mode & 0777) | HIDE_CHMOD); + mode = ((stat_buf.st_mode & 0777) | 0600); /* make it writable */ (void) fclose(nfp); nfp = NULL; (void) chmod(newfile, mode); @@ -547,6 +547,29 @@ PUBLIC void remove_bookmark_link ARGS2( #ifdef DOSPATH remove(filename_buffer); #endif /* DOSPATH */ + +#ifdef UNIX + /* + * By copying onto the bookmark file, rather than renaming it, we + * can preserve the original ownership of the file, provided that + * it is writable by the current process. + * Changed to copy 1998-04-26 -- gil + */ + { char buffer[3072]; + + sprintf(buffer, "%s %s %s && %s %s", + COPY_PATH, newfile, filename_buffer, + RM_PATH, newfile); + + CTRACE(tfp, "remove_bookmark_link: %s\n", buffer); + if( system( buffer ) ) { + _statusline(BOOKTEMP_COPY_FAIL); + sleep(AlertSecs); + } else { + return; + } + } +#else /* UNIX */ if (rename(newfile, filename_buffer) != -1) { #ifdef VMS char VMSfilename[256]; @@ -571,10 +594,11 @@ PUBLIC void remove_bookmark_link ARGS2( * Used to be ODD_RENAME */ #ifdef _WINDOWS - if (errno == ENOTSAM) { + if (errno == ENOTSAM) #else - if (errno == EXDEV) { + if (errno == EXDEV) #endif /* WINDOWS */ + { char buffer[2048]; sprintf(buffer, "%s %s %s", MV_PATH, newfile, filename_buffer); system(buffer); @@ -591,6 +615,7 @@ PUBLIC void remove_bookmark_link ARGS2( perror("renaming the file"); sleep(AlertSecs); } +#endif /* UNIX */ failure: _statusline(BOOKMARK_DEL_FAILED); |