search for: statb

Displaying 7 results from an estimated 7 matches for "statb".

Did you mean: state
2020 Mar 28
0
[klibc:update-dash] dash: exec: Do not allocate stack string in padvance
.../dash/mail.c | 7 +++++-- usr/dash/main.c | 12 +++++------- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/usr/dash/cd.c b/usr/dash/cd.c index a4e024d8..610a4fa8 100644 --- a/usr/dash/cd.c +++ b/usr/dash/cd.c @@ -98,6 +98,7 @@ cdcmd(int argc, char **argv) char c; struct stat statb; int flags; + int len; flags = cdopt(); dest = *argptr; @@ -127,9 +128,10 @@ dotdot: if (!*dest) dest = "."; path = bltinlookup("CDPATH"); - while (path) { - c = *path; - p = padvance(&path, dest); + while (p = path, (len = padvance(&path, dest)) >= 0...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Stricter pathopt parsing
...if (!(act & DO_NOFUNC) && - prefix(pathopt, "func")) { + } else if (!(act & DO_NOFUNC)) { /* handled below */ } else { /* ignore unimplemented options */ @@ -397,7 +443,7 @@ loop: e = EACCES; /* if we fail, this will be the error */ if (!S_ISREG(statb.st_mode)) continue; - if (pathopt) { /* this is a %func directory */ + if (lpathopt) { /* this is a %func directory */ stalloc(len); readcmdfile(fullname); if ((cmdp = cmdlookup(name, 0)) == NULL || @@ -515,39 +561,26 @@ hashcd(void) void changepath(const char *newval) { - co...
1999 Feb 10
1
When a shell says no (clobber) it means maybe.
...I've overlooked) why they should do this and not say noclobber => O_EXCL, end of story ? exec.c from pdksh-5.2.12 1293 case IOWRITE: 1294 flags = O_WRONLY | O_CREAT | O_TRUNC; 1295 if (Flag(FNOCLOBBER) && !(iop->flag & IOCLOB) 1296 && (stat(cp, &statb) < 0 || S_ISREG(statb.st_mode))) 1297 flags |= O_EXCL; 1298 break; execute_cmd.c from bash-1.14.7 2834 stat_result = stat (redirectee_word, &finfo); 2835 2836 if ((stat_result == 0) && (S_ISREG (finfo.st_mode))) 2837 { 2838 free (redirectee_word); 2839...
2019 Jan 25
0
[klibc:update-dash] expand: Fix buffer overflow in expandmeta
...e) } } if (metaflag == 0) { /* we've reached the end of the file name */ - if (enddir != expdir) - metaflag++; + if (!expdir_len) + return; p = name; do { if (*p == '\\') p++; *enddir++ = *p; } while (*p++); - if (metaflag == 0 || lstat64(expdir, &statb) >= 0) + if (lstat64(expdir, &statb) >= 0) addfname(expdir); return; } @@ -1369,18 +1371,13 @@ expmeta(char *enddir, char *name) *enddir++ = *p++; } while (p < start); } - if (enddir == expdir) { + *enddir = 0; + cp = expdir; + expdir_len = enddir - cp; + if (!expdir...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix buffer overflow in expandmeta
...e) } } if (metaflag == 0) { /* we've reached the end of the file name */ - if (enddir != expdir) - metaflag++; + if (!expdir_len) + return; p = name; do { if (*p == '\\') p++; *enddir++ = *p; } while (*p++); - if (metaflag == 0 || lstat64(expdir, &statb) >= 0) + if (lstat64(expdir, &statb) >= 0) addfname(expdir); return; } @@ -1369,18 +1371,13 @@ expmeta(char *enddir, char *name) *enddir++ = *p++; } while (p < start); } - if (enddir == expdir) { + *enddir = 0; + cp = expdir; + expdir_len = enddir - cp; + if (!expdir...
2002 Nov 05
0
[PATCH] Add getlink command to sftp
...if (attrib != NULL) + *attrib = *a; + xfree(longname); buffer_free(&msg); *************** *** 719,724 **** --- 722,774 ---- return(filename); } + int + do_getlink(struct sftp_conn *conn, char *path) + { + char *dest; + u_int status = 0; + int ret; + struct stat statb; + char *filename; + Attrib *a; + Attrib attrib; + + a = do_lstat(conn, path, 0); + if (a == NULL || !S_ISLNK(a->perm)) { + if (a != NULL) + error("%s is not a symlink", path); + return(-1); + } + + dest = do_readlink(conn, path, &attrib); + if (dest == NULL) +...
2007 Jun 09
41
zfs reports small st_size for directories?
Why does ZFS report such small directory sizes? For example, take a maildir directory with ten entries: total 2385 drwx------ 8 17121 vmail 10 Jun 8 23:50 . drwx--x--x 14 root root 14 May 12 2006 .. drwx------ 5 17121 vmail 5 May 25 18:16 .Trash drwx------ 5 17121 staff 6 Jun 9 00:01 .testing -rw------- 1 17121 staff 0 Jun