Bugzilla – Attachment 2989 Details for
Bug 2710
remote ls -l <name> produces inconsistent info
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Replace link count with '?' when unavailable
bz2710.diff (text/plain), 1.77 KB, created by
Damien Miller
on 2017-06-02 15:59:32 AEST
(
hide
)
Description:
Replace link count with '?' when unavailable
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2017-06-02 15:59:32 AEST
Size:
1.77 KB
patch
obsolete
>diff --git a/sftp-common.c b/sftp-common.c >index 3a70c52d..3135ccd0 100644 >--- a/sftp-common.c >+++ b/sftp-common.c >@@ -216,22 +216,21 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units) > int ulen, glen, sz = 0; > struct tm *ltime = localtime(&st->st_mtime); > char *user, *group; >- char buf[1024], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; >+ char buf[1024], lc[8], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; > char sbuf[FMT_SCALED_STRSIZE]; > time_t now; > > strmode(st->st_mode, mode); >- if (!remote) { >- user = user_from_uid(st->st_uid, 0); >- } else { >+ if (remote) { > snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); > user = ubuf; >- } >- if (!remote) { >- group = group_from_gid(st->st_gid, 0); >- } else { > snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); > group = gbuf; >+ strlcpy(lc, "?", sizeof(lc)); >+ } else { >+ user = user_from_uid(st->st_uid, 0); >+ group = group_from_gid(st->st_gid, 0); >+ snprintf(lc, sizeof(lc), "%u", (u_int)st->st_nlink); > } > if (ltime != NULL) { > now = time(NULL); >@@ -247,12 +246,12 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units) > glen = MAXIMUM(strlen(group), 8); > if (si_units) { > fmt_scaled((long long)st->st_size, sbuf); >- snprintf(buf, sizeof buf, "%s %3u %-*s %-*s %8s %s %s", mode, >- (u_int)st->st_nlink, ulen, user, glen, group, >+ snprintf(buf, sizeof buf, "%s %3s %-*s %-*s %8s %s %s", >+ mode, lc, ulen, user, glen, group, > sbuf, tbuf, name); > } else { >- snprintf(buf, sizeof buf, "%s %3u %-*s %-*s %8llu %s %s", mode, >- (u_int)st->st_nlink, ulen, user, glen, group, >+ snprintf(buf, sizeof buf, "%s %3s %-*s %-*s %8llu %s %s", >+ mode, lc, ulen, user, glen, group, > (unsigned long long)st->st_size, tbuf, name); > } > return xstrdup(buf);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 2710
: 2989