summaryrefslogtreecommitdiff
path: root/system/ksh-openbsd/patches/linux/c_sh_c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'system/ksh-openbsd/patches/linux/c_sh_c.diff')
-rw-r--r--system/ksh-openbsd/patches/linux/c_sh_c.diff49
1 files changed, 49 insertions, 0 deletions
diff --git a/system/ksh-openbsd/patches/linux/c_sh_c.diff b/system/ksh-openbsd/patches/linux/c_sh_c.diff
new file mode 100644
index 0000000000..09b74c7a0b
--- /dev/null
+++ b/system/ksh-openbsd/patches/linux/c_sh_c.diff
@@ -0,0 +1,49 @@
+--- ksh-openbsd_cvs/c_sh.c 2010-03-27 17:25:30.000000000 +0100
++++ ksh-openbsd_cvs.new/c_sh.c 2010-04-01 21:01:24.132137763 +0200
+@@ -837,19 +837,13 @@ c_mknod(char **wp)
+ {
+ int argc, optc, ismkfifo = 0, ret;
+ char **argv;
+- void *set = NULL;
+- mode_t mode = 0, oldmode = 0;
++ mode_t mode = 0, old_umask = -1;
+
+ while ((optc = ksh_getopt(wp, &builtin_opt, "m:")) != -1) {
+ switch (optc) {
+ case 'm':
+- set = setmode(builtin_opt.optarg);
+- if (set == NULL) {
+- bi_errorf("invalid file mode");
+- return 1;
+- }
+- mode = getmode(set, DEFFILEMODE);
+- free(set);
++ old_umask = umask(0);
++ mode |= strtoul(builtin_opt.optarg, NULL, 8);
+ break;
+ default:
+ goto usage;
+@@ -866,18 +860,17 @@ c_mknod(char **wp)
+ } else if (argc != 4)
+ goto usage;
+
+- if (set)
+- oldmode = umask(0);
+- else
+- mode = DEFFILEMODE;
++ if (old_umask == -1)
++ mode |= DEFFILEMODE;
+
+ if (ismkfifo)
+ ret = domkfifo(argc, argv, mode);
+ else
+ ret = domknod(argc, argv, mode);
+
+- if (set)
+- umask(oldmode);
++ if (old_umask != -1)
++ umask(old_umask);
++
+ return ret;
+ usage:
+ builtin_argv0 = NULL;