Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: check deleted .zwc files
- X-seq: zsh-workers 14813
- From: Clint Adams <clint@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: check deleted .zwc files
- Date: Fri, 8 Jun 2001 14:17:19 -0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This seems to work; functions can be autoloaded from
deleted-but-still-open digest files. Is any further
logic needed to prevent anything?
Index: zshconfig.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
retrieving revision 1.3
diff -u -r1.3 zshconfig.ac
--- zshconfig.ac 2001/06/06 16:55:23 1.3
+++ zshconfig.ac 2001/06/08 18:10:51
@@ -912,7 +912,8 @@
AC_CHECK_FUNCS(strftime difftime gettimeofday \
select poll \
- readlink lstat lchown faccessx fchdir ftruncate \
+ readlink faccessx fchdir ftruncate \
+ fstat lstat lchown \
fseeko ftello \
mkfifo _mktemp \
waitpid wait3 \
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.20
diff -u -r1.20 parse.c
--- Src/parse.c 2001/05/15 08:38:59 1.20
+++ Src/parse.c 2001/06/08 18:10:52
@@ -2827,6 +2827,7 @@
d->addr = addr;
d->len = len;
d->count = 0;
+ d->filename = ztrdup(dump);
}
#endif
@@ -2854,7 +2855,7 @@
dig = dyncat(path, FD_EXT);
wc = dyncat(file, FD_EXT);
- rd = stat(dig, &std);
+ rd = zwcstat(dig, &std, dumps);
rc = stat(wc, &stc);
rn = stat(file, &stn);
@@ -2934,7 +2935,7 @@
struct stat lsbuf;
if (!sbuf) {
- if (stat(file, &lsbuf))
+ if (zwcstat(file, &lsbuf, dumps))
return NULL;
sbuf = &lsbuf;
}
@@ -3077,6 +3078,7 @@
dumps = p->next;
munmap((void *) f->addr, f->len);
zclose(f->fd);
+ zsfree(f->filename);
zfree(f, sizeof(*f));
}
}
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.30
diff -u -r1.30 utils.c
--- Src/utils.c 2001/05/29 15:09:06 1.30
+++ Src/utils.c 2001/06/08 18:10:53
@@ -3829,3 +3829,20 @@
return 0;
}
#endif
+
+/**/
+mod_export int
+zwcstat(char *filename, struct stat *buf, FuncDump dumps)
+{
+ FuncDump f;
+
+ if (stat(filename, buf)) {
+#ifdef HAVE_FSTAT
+ for (f = dumps; f; f = f->next) {
+ if (!fstat(f->fd, buf)) return 0;
+ }
+#endif
+ return 1;
+ } else return 0;
+
+}
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.29
diff -u -r1.29 zsh.h
--- Src/zsh.h 2001/05/15 16:32:28 1.29
+++ Src/zsh.h 2001/06/08 18:10:53
@@ -493,6 +493,7 @@
Wordcode addr; /* mapped region */
int len; /* length */
int count; /* reference count */
+ char *filename;
};
struct eprog {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author