lstat64:: use Posix st_mode defines
authorTheodore Ts'o <tytso@mit.edu>
Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 4 Aug 2015 04:10:49 +0000 (14:10 +1000)
Instead of the  obsolete SysV S_IEXEC, S_IREAD, and S_IWRITE, use
the Posix defines of S_I[WRX]{OTH,GRP,USR}.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
src/lstat64.c

index 3b68c66b512ec943aa7768b43c053f6233a1e8b7..c8a0cc6c05b129bde1ce039b8ed9a624a4086f41 100644 (file)
@@ -92,23 +92,23 @@ main(int argc, char **argv)
                        printf("  Size: %-10llu", (unsigned long long)sbuf.st_size);
                }
 
-               if (sbuf.st_mode & (S_IEXEC>>6))
+               if (sbuf.st_mode & S_IXOTH)
                        mode[9] = 'x';
-               if (sbuf.st_mode & (S_IWRITE>>6))
+               if (sbuf.st_mode & S_IWOTH)
                        mode[8] = 'w';
-               if (sbuf.st_mode & (S_IREAD>>6))
+               if (sbuf.st_mode & S_IROTH)
                        mode[7] = 'r';
-               if (sbuf.st_mode & (S_IEXEC>>3))
+               if (sbuf.st_mode & S_IXGRP)
                        mode[6] = 'x';
-               if (sbuf.st_mode & (S_IWRITE>>3))
+               if (sbuf.st_mode & S_IWGRP)
                        mode[5] = 'w';
-               if (sbuf.st_mode & (S_IREAD>>3))
+               if (sbuf.st_mode & S_IRGRP)
                        mode[4] = 'r';
-               if (sbuf.st_mode & S_IEXEC)
+               if (sbuf.st_mode & S_IXUSR)
                        mode[3] = 'x';
-               if (sbuf.st_mode & S_IWRITE)
+               if (sbuf.st_mode & S_IWUSR)
                        mode[2] = 'w';
-               if (sbuf.st_mode & S_IREAD)
+               if (sbuf.st_mode & S_IRUSR)
                        mode[1] = 'r';
                if (sbuf.st_mode & S_ISVTX)
                        mode[9] = 't';