diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-06-18 07:34:34 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-06-18 07:34:34 +0000 |
commit | 39e152d2973235b824253bb82619199389dd9c40 (patch) | |
tree | 04d7a7ddad7f6c6f011fa991d47cc37479bb2122 | |
parent | 3c7f60d08479cf4f8da842c3305f8deeedef8031 (diff) | |
download | zsh-39e152d2973235b824253bb82619199389dd9c40.tar.gz zsh-39e152d2973235b824253bb82619199389dd9c40.tar.xz zsh-39e152d2973235b824253bb82619199389dd9c40.zip |
make zcompile unlink() the zwc file first (in case it is currently mapped we don't want to overwrite it); also, create the file read-only (14952)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/parse.c | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 1ded9cb6d..b792f75a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2001-06-18 Sven Wischnowsky <wischnow@zsh.org> + * 14952: Src/parse.c: make zcompile unlink() the zwc file first + (in case it is currently mapped we don't want to overwrite it); + also, create the file read-only + * 14951: Src/signals.c, Src/signals.h: rename handler() to zhandler() because it's now exported to modules diff --git a/Src/parse.c b/Src/parse.c index 09e60ead2..dd89ab0cd 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2544,7 +2544,8 @@ build_dump(char *nam, char *dump, char **files, int ali, int map, int flags) if (!strsfx(FD_EXT, dump)) dump = dyncat(dump, FD_EXT); - if ((dfd = open(dump, O_WRONLY|O_CREAT, 0600)) < 0) { + unlink(dump); + if ((dfd = open(dump, O_WRONLY|O_CREAT, 0444)) < 0) { zwarnnam(nam, "can't write zwc file: %s", dump, 0); return 1; } @@ -2675,7 +2676,8 @@ build_cur_dump(char *nam, char *dump, char **names, int match, int map, if (!strsfx(FD_EXT, dump)) dump = dyncat(dump, FD_EXT); - if ((dfd = open(dump, O_WRONLY|O_CREAT, 0600)) < 0) { + unlink(dump); + if ((dfd = open(dump, O_WRONLY|O_CREAT, 0444)) < 0) { zwarnnam(nam, "can't write zwc file: %s", dump, 0); return 1; } @@ -2779,10 +2781,10 @@ static FuncDump dumps; static int zwcstat(char *filename, struct stat *buf, FuncDump dumps) { - FuncDump f; - if (stat(filename, buf)) { #ifdef HAVE_FSTAT + FuncDump f; + for (f = dumps; f; f = f->next) { if (!strncmp(filename, f->filename, strlen(f->filename)) && !fstat(f->fd, buf)) |