aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-08-14 02:28:49 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-08-14 02:28:49 +0000
commit062913f66288b93aaefe052cb15b4115f4b1a839 (patch)
tree617233bd75fd9211892e0ed5d9c2720b302adb5c
parentbf83355dda609db2d028ecb740e1daa5cfbe15aa (diff)
downloadbusybox-062913f66288b93aaefe052cb15b4115f4b1a839.tar.gz
Fix a bug reported by junkio@cox.net involving the mode_chars index.
-rw-r--r--libbb/mode_string.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libbb/mode_string.c b/libbb/mode_string.c
index 8d4d736ef..83142ba8a 100644
--- a/libbb/mode_string.c
+++ b/libbb/mode_string.c
@@ -20,6 +20,11 @@
*
*/
+/* 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);