Fix a bug reported by junkio@cox.net involving the mode_chars index.
authorManuel Novoa III <mjn3@codepoet.org>
Thu, 14 Aug 2003 02:28:49 +0000 (02:28 -0000)
committerManuel Novoa III <mjn3@codepoet.org>
Thu, 14 Aug 2003 02:28:49 +0000 (02:28 -0000)
libbb/mode_string.c

index 8d4d736ef83c037a1ea857cd7658a12594c6eb96..83142ba8a25d2a5d47a5b4b42e25846bfef92078 100644 (file)
  *
  */
 
+/* Aug 13, 2003
+ * Fix a bug reported by junkio@cox.net involving the mode_chars index.
+ */
+
+
 #include <assert.h>
 #include <sys/stat.h>
 
@@ -119,7 +124,7 @@ const char *bb_mode_string(int mode)
                } while (++j < 3);
                ++i;
                if (mode & (010000 >> i)) {
-                       *p = mode_chars[3 + k + (i >> 1)];
+                       *p = mode_chars[3 + (k & 2) + (i == 3)];
                }
        } while (i < 3);