From: Eric Andersen Date: Sat, 13 Apr 2002 14:26:44 +0000 (-0000) Subject: Teach makedevs to not segfault quite so much X-Git-Tag: 0_60_3~21 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=19732c6226e9f2f89b9294e3c23af2bfbb084cec;p=oweals%2Fbusybox.git Teach makedevs to not segfault quite so much --- 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;