summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/parse.c10
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))