diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/parse.c | 6 | ||||
-rw-r--r-- | Src/utils.c | 17 | ||||
-rw-r--r-- | Src/zsh.h | 1 |
3 files changed, 22 insertions, 2 deletions
diff --git a/Src/parse.c b/Src/parse.c index 78b14fb41..ea0dffdef 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2827,6 +2827,7 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len) d->addr = addr; d->len = len; d->count = 0; + d->filename = ztrdup(dump); } #endif @@ -2854,7 +2855,7 @@ try_dump_file(char *path, char *name, char *file, int *ksh) 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 @@ check_dump_file(char *file, struct stat *sbuf, char *name, int *ksh) struct stat lsbuf; if (!sbuf) { - if (stat(file, &lsbuf)) + if (zwcstat(file, &lsbuf, dumps)) return NULL; sbuf = &lsbuf; } @@ -3077,6 +3078,7 @@ decrdumpcount(FuncDump f) dumps = p->next; munmap((void *) f->addr, f->len); zclose(f->fd); + zsfree(f->filename); zfree(f, sizeof(*f)); } } diff --git a/Src/utils.c b/Src/utils.c index 6bede2e43..cd7685e6e 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3829,3 +3829,20 @@ mailstat(char *path, struct stat *st) 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; + +} diff --git a/Src/zsh.h b/Src/zsh.h index 1d8d8888b..c510b9759 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -493,6 +493,7 @@ struct funcdump { Wordcode addr; /* mapped region */ int len; /* length */ int count; /* reference count */ + char *filename; }; struct eprog { |