Instead of S_IEXEC, S_IREAD, and S_IWRITE, use the Posix defines of
S_I[WRX]{OTH,GRP,USR}.

Signed-off-by: Theodore Ts'o <[email protected]>
---
 src/lstat64.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/lstat64.c b/src/lstat64.c
index 3b68c66..c8a0cc6 100644
--- a/src/lstat64.c
+++ b/src/lstat64.c
@@ -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';
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to