Show usage instead of segfaulting when no args are passed.
0d844078 added typec and assigned value without actually using it.
As variable is properly named just use it in coressponding switch.
Signed-off-by: maximilian attems <max at stro.at>
---
usr/utils/mknod.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/usr/utils/mknod.c b/usr/utils/mknod.c
index 14f8fdd..fa7ac7a 100644
--- a/usr/utils/mknod.c
+++ b/usr/utils/mknod.c
@@ -20,6 +20,8 @@ int main(int argc, char *argv[])
dev_t dev;
progname = *argv++;
+ if (argc == 1)
+ usage();
if (argv[0][0] == '-' && argv[0][1] == 'm' &&
!argv[0][2]) {
mode_set = strtoul(argv[1], &endp, 8);
@@ -36,7 +38,7 @@ int main(int argc, char *argv[])
typec = type[0];
mode = 0;
- switch (type[0]) {
+ switch (typec) {
case 'c':
mode = S_IFCHR;
break;
--
1.7.2.3