From 19732c6226e9f2f89b9294e3c23af2bfbb084cec Mon Sep 17 00:00:00 2001 From: Eric Andersen <andersen@codepoet.org> Date: Sat, 13 Apr 2002 14:26:44 +0000 Subject: Teach makedevs to not segfault quite so much --- miscutils/makedevs.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'miscutils') 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; -- cgit v1.2.3