aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-04-13 14:26:44 +0000
committerEric Andersen <andersen@codepoet.org>2002-04-13 14:26:44 +0000
commit19732c6226e9f2f89b9294e3c23af2bfbb084cec (patch)
tree8cb27a6dc89fb8bd13f918e86a443e08adfa894d
parent4e116823f406a51daf1aeeaad538d613d2b51cc1 (diff)
downloadbusybox-19732c6226e9f2f89b9294e3c23af2bfbb084cec.tar.gz
Teach makedevs to not segfault quite so much
-rw-r--r--miscutils/makedevs.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index b8c6dd1d8..4e50a6d71 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -17,23 +17,22 @@
int makedevs_main(int argc, char **argv)
{
-
- const char *basedev = argv[1];
- const char *type = argv[2];
- int major = atoi(argv[3]);
- int Sminor = atoi(argv[4]);
- int S = atoi(argv[5]);
- int E = atoi(argv[6]);
- int sbase = argc == 8 ? 1 : 0;
-
- mode_t mode = 0;
dev_t dev = 0;
- char devname[255];
- char buf[255];
+ mode_t mode = 0;
+ char *basedev, *type, devname[255], buf[255];
+ int major, Sminor, S, E, sbase;
if (argc < 7 || *argv[1]=='-')
show_usage();
+ basedev = argv[1];
+ type = argv[2];
+ major = atoi(argv[3]);
+ Sminor = atoi(argv[4]);
+ S = atoi(argv[5]);
+ E = atoi(argv[6]);
+ sbase = argc == 8 ? 1 : 0;
+
switch (type[0]) {
case 'c':
mode = S_IFCHR;