From 1e16609b8eac585fc0679ca4466b2c1f56ecebae Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 27 Jun 2023 13:09:05 -0400 Subject: mknod: Parse mode option argument --- (limited to 'helpers') 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 #include #include +#include "defs.h" +#include "mode.h" #ifdef ENABLE_NLS #include @@ -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:" -- cgit v0.9.1