mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Fix supported range of uid/gid numbers
POSIX says they must be positive numbers, so why was I using an 'int'!? Fixes #253.
This commit is contained in:
parent
61feee5657
commit
b853185413
4 changed files with 7 additions and 7 deletions
|
|
@ -75,9 +75,9 @@ static void browse_draw_info(struct dir *dr) {
|
|||
time_t t = (time_t)e->mtime;
|
||||
if(e->flags & FFE_MODE) ncaddstr(4, 9, fmtmode(e->mode));
|
||||
else ncaddstr(4, 9, "N/A");
|
||||
if(e->flags & FFE_UID) ncprint(4, 26, "%d", e->uid);
|
||||
if(e->flags & FFE_UID) ncprint(4, 26, "%u", e->uid);
|
||||
else ncaddstr(4, 26, "N/A");
|
||||
if(e->flags & FFE_GID) ncprint(4, 38, "%d", e->gid);
|
||||
if(e->flags & FFE_GID) ncprint(4, 38, "%u", e->gid);
|
||||
else ncaddstr(4, 38, "N/A");
|
||||
if(e->flags & FFE_MTIME) {
|
||||
strftime(mbuf, sizeof(mbuf), "%Y-%m-%d %H:%M:%S %z", localtime(&t));
|
||||
|
|
|
|||
|
|
@ -469,12 +469,12 @@ static int iteminfo(void) {
|
|||
C(rint64(&iv, UINT64_MAX));
|
||||
ctx->buf_dir->ino = iv;
|
||||
} else if(strcmp(ctx->val, "uid") == 0) { /* uid */
|
||||
C(rint64(&iv, INT32_MAX));
|
||||
C(rint64(&iv, UINT32_MAX));
|
||||
ctx->buf_dir->flags |= FF_EXT;
|
||||
ctx->buf_ext->flags |= FFE_UID;
|
||||
ctx->buf_ext->uid = iv;
|
||||
} else if(strcmp(ctx->val, "gid") == 0) { /* gid */
|
||||
C(rint64(&iv, INT32_MAX));
|
||||
C(rint64(&iv, UINT32_MAX));
|
||||
ctx->buf_dir->flags |= FF_EXT;
|
||||
ctx->buf_ext->flags |= FFE_GID;
|
||||
ctx->buf_ext->gid = iv;
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ static void stat_to_dir(struct stat *fs) {
|
|||
|
||||
buf_ext->mode = fs->st_mode;
|
||||
buf_ext->mtime = fs->st_mtime;
|
||||
buf_ext->uid = (int)fs->st_uid;
|
||||
buf_ext->gid = (int)fs->st_gid;
|
||||
buf_ext->uid = (unsigned int)fs->st_uid;
|
||||
buf_ext->gid = (unsigned int)fs->st_gid;
|
||||
buf_ext->flags = FFE_MTIME | FFE_UID | FFE_GID | FFE_MODE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ struct dir {
|
|||
* macros to help manage this. */
|
||||
struct dir_ext {
|
||||
uint64_t mtime;
|
||||
int uid, gid;
|
||||
unsigned int uid, gid;
|
||||
unsigned short mode;
|
||||
unsigned char flags;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue