Teach makedevs to not segfault quite so much

This commit is contained in:
Eric Andersen 2002-04-13 14:26:44 +00:00
parent 4e116823f4
commit 19732c6226

View File

@ -17,23 +17,22 @@
int makedevs_main(int argc, char **argv) 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; dev_t dev = 0;
char devname[255]; mode_t mode = 0;
char buf[255]; char *basedev, *type, devname[255], buf[255];
int major, Sminor, S, E, sbase;
if (argc < 7 || *argv[1]=='-') if (argc < 7 || *argv[1]=='-')
show_usage(); 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]) { switch (type[0]) {
case 'c': case 'c':
mode = S_IFCHR; mode = S_IFCHR;