]> git.sesse.net Git - betaftpd/commitdiff
Use S_IS*() macros instead of testing the bitflags ourselves.
authorsgunderson <sgunderson>
Thu, 27 Jul 2000 01:56:17 +0000 (01:56 +0000)
committersgunderson <sgunderson>
Thu, 27 Jul 2000 01:56:17 +0000 (01:56 +0000)
cmds.c

diff --git a/cmds.c b/cmds.c
index 6c277af284ba815871f7e36dab8e4059af1b20f9..64e4c1a9eb86670d94a9db9cf60b3d5c1ea36f55 100644 (file)
--- a/cmds.c
+++ b/cmds.c
@@ -1052,7 +1052,7 @@ int long_listing(char * const retbuf, const char * const pathname, const int do_
 #if WANT_NONROOT
                char rights[16];
 
-               if (nr_check_permission(0, pathname, 0, (buf.st_mode & S_IFDIR), rights) == -1) {
+               if (nr_check_permission(0, pathname, 0, (S_ISDIR(buf.st_mode)), rights) == -1) {
                        /* no permission to even see this file */
                        return 0;
                }
@@ -1664,13 +1664,13 @@ void prepare_for_transfer(struct ftran *f)
  *             The most common cases are put first, for speed :-)
  */
 char decode_mode(mode_t mode) {
-       if (mode & S_IFREG)  return '-';
-       if (mode & S_IFDIR)  return 'd';
-       if (mode & S_IFLNK)  return 'l';
-       if (mode & S_IFBLK)  return 'b';
-       if (mode & S_IFCHR)  return 'c';
-       if (mode & S_IFSOCK) return 's';
-       if (mode & S_IFIFO)  return 'f';
+       if (S_ISREG(mode))  return '-';
+       if (S_ISDIR(mode))  return 'd';
+       if (S_ISLNK(mode))  return 'l';
+       if (S_ISBLK(mode))  return 'b';
+       if (S_ISCHR(mode))  return 'c';
+       if (S_ISSOCK(mode)) return 's';
+       if (S_ISFIFO(mode))  return 'f';
 
        return '-';
 }