summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-06-27 13:09:05 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-06-27 13:09:05 (EDT)
commit1e16609b8eac585fc0679ca4466b2c1f56ecebae (patch)
tree4a8b949d87b4dc0cdfe64d65c9db1160d3ae7e78 /helpers
parente43c5b7cd456449ebcf06c15c08473071f9f6ad5 (diff)
mknod: Parse mode option argument
Diffstat (limited to 'helpers')
-rw-r--r--helpers/mknod.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/helpers/mknod.c b/helpers/mknod.c
index 93ef974..7328d66 100644
--- a/helpers/mknod.c
+++ b/helpers/mknod.c
@@ -26,6 +26,8 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#include "defs.h"
+#include "mode.h"
#ifdef ENABLE_NLS
#include <locale.h>
@@ -130,7 +132,16 @@ main(int argc, char *argv[])
#endif
switch(opt) {
case 'm':
- /* TODO: Parse mode. */
+ mode = umask(0);
+ umask(mode);
+ mode = 0666 ^ mode;
+ if (opkg_opk_helper_mode_parse(mode, optarg,
+ &mode) != OPKG_OPK_OK) {
+ fprintf(stderr, _("%s: Invalid mode "
+ "\"%s\"\n"),
+ program_name, optarg);
+ return EXIT_FAILURE;
+ }
break;
default:
fprintf(stderr, _("%s: Warning: Unknown option:"