[PATCH 6/6] commands: stat: print mode in octal if type unknown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The stat command is meant as debugging aid and thus it's useful to print
information about the mode, even for broken inodes that lack file type
information in their mode field.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 fs/fs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 8cdd0c55202b..57bd781025f9 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -201,6 +201,8 @@ void stat_print(int dirfd, const char *filename, const struct stat *st)
 
 	if (type)
 		printf("  %s%s", typeprefix, type);
+	else
+		printf("  unknown (mode=0%o)", st->st_mode);
 
 	fdev = get_fsdevice_by_path(dirfd, filename);
 
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux