From 5fbdad94ac145c59308200d689eea40e79a7ec5e Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 6 Aug 2019 10:05:23 -0700 Subject: lsof: simplify octal mode display. Since this masks, it doesn't actually have the same bug as e5942a8c90c2f52550496fdf08efddb564d8e5a3, but we may as well fix the other example of that questionable idiom while we're thinking about it... --- toys/pending/lsof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys') diff --git a/toys/pending/lsof.c b/toys/pending/lsof.c index 2852f41f..5ab3af90 100644 --- a/toys/pending/lsof.c +++ b/toys/pending/lsof.c @@ -261,7 +261,7 @@ static void fill_stat(struct file_info *fi, const char *path) case S_IFREG: strcpy(fi->type, "REG"); break; case S_IFSOCK: strcpy(fi->type, "sock"); break; default: - snprintf(fi->type, sizeof(fi->type), "0%03o", sb.st_mode & S_IFMT); + snprintf(fi->type, sizeof(fi->type), "%04o", sb.st_mode & S_IFMT); break; } -- cgit v1.2.3