zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: check deleted .zwc files
@ 2001-06-08 18:17 Clint Adams
  2001-06-08 18:50 ` Bart Schaefer
  2001-06-09 10:05 ` Cygwin failure " Andrej Borsenkow
  0 siblings, 2 replies; 15+ messages in thread
From: Clint Adams @ 2001-06-08 18:17 UTC (permalink / raw)
  To: zsh-workers


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 {


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2001-06-18  7:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-08 18:17 PATCH: check deleted .zwc files Clint Adams
2001-06-08 18:50 ` Bart Schaefer
2001-06-08 19:04   ` Clint Adams
2001-06-08 19:46     ` Bart Schaefer
2001-06-08 19:53       ` Clint Adams
2001-06-09  5:37         ` Andrej Borsenkow
2001-06-10 11:11           ` Clint Adams
2001-06-09 20:58         ` Bart Schaefer
2001-06-10 11:34           ` Clint Adams
2001-06-13  5:03             ` Bart Schaefer
2001-06-13  8:59               ` Sven Wischnowsky
2001-06-13 10:22                 ` Bart Schaefer
2001-06-18  7:31                   ` Sven Wischnowsky
2001-06-09 10:05 ` Cygwin failure " Andrej Borsenkow
2001-06-09 17:42   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).