diff options
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c index 53700c687f..003d4c3fa4 100644 --- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c +++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | |||
@@ -434,7 +434,6 @@ static int parse_devtable(FILE * devtable) | |||
434 | static struct option long_options[] = { | 434 | static struct option long_options[] = { |
435 | {"root", 1, NULL, 'r'}, | 435 | {"root", 1, NULL, 'r'}, |
436 | {"help", 0, NULL, 'h'}, | 436 | {"help", 0, NULL, 'h'}, |
437 | {"squash", 0, NULL, 'q'}, | ||
438 | {"version", 0, NULL, 'v'}, | 437 | {"version", 0, NULL, 'v'}, |
439 | {"devtable", 1, NULL, 'D'}, | 438 | {"devtable", 1, NULL, 'D'}, |
440 | {NULL, 0, NULL, 0} | 439 | {NULL, 0, NULL, 0} |
@@ -446,7 +445,6 @@ static char *helptext = | |||
446 | "Options:\n" | 445 | "Options:\n" |
447 | " -r, -d, --root=DIR Build filesystem from directory DIR (default: cwd)\n" | 446 | " -r, -d, --root=DIR Build filesystem from directory DIR (default: cwd)\n" |
448 | " -D, --devtable=FILE Use the named FILE as a device table file\n" | 447 | " -D, --devtable=FILE Use the named FILE as a device table file\n" |
449 | " -q, --squash Squash permissions and owners making all files be owned by root\n" | ||
450 | " -h, --help Display this help text\n" | 448 | " -h, --help Display this help text\n" |
451 | " -v, --version Display version information\n\n"; | 449 | " -v, --version Display version information\n\n"; |
452 | 450 | ||
@@ -463,9 +461,15 @@ int main(int argc, char **argv) | |||
463 | FILE *passwd_file = NULL; | 461 | FILE *passwd_file = NULL; |
464 | FILE *group_file = NULL; | 462 | FILE *group_file = NULL; |
465 | FILE *devtable = NULL; | 463 | FILE *devtable = NULL; |
464 | DIR *dir = NULL; | ||
466 | 465 | ||
467 | umask (0); | 466 | umask (0); |
468 | 467 | ||
468 | if (argc==1) { | ||
469 | fprintf(stderr, helptext); | ||
470 | exit(1); | ||
471 | } | ||
472 | |||
469 | while ((opt = getopt_long(argc, argv, "D:d:r:qhv", | 473 | while ((opt = getopt_long(argc, argv, "D:d:r:qhv", |
470 | long_options, &c)) >= 0) { | 474 | long_options, &c)) >= 0) { |
471 | switch (opt) { | 475 | switch (opt) { |
@@ -484,6 +488,11 @@ int main(int argc, char **argv) | |||
484 | if (rootdir != default_rootdir) { | 488 | if (rootdir != default_rootdir) { |
485 | error_msg_and_die("root directory specified more than once"); | 489 | error_msg_and_die("root directory specified more than once"); |
486 | } | 490 | } |
491 | if ((dir = opendir(optarg)) == NULL) { | ||
492 | perror_msg_and_die(optarg); | ||
493 | } else { | ||
494 | closedir(dir); | ||
495 | } | ||
487 | rootdir = xstrdup(optarg); | 496 | rootdir = xstrdup(optarg); |
488 | break; | 497 | break; |
489 | 498 | ||
@@ -497,6 +506,11 @@ int main(int argc, char **argv) | |||
497 | } | 506 | } |
498 | } | 507 | } |
499 | 508 | ||
509 | if (argv[optind] != NULL) { | ||
510 | fprintf(stderr, helptext); | ||
511 | exit(1); | ||
512 | } | ||
513 | |||
500 | // Get name-id mapping | 514 | // Get name-id mapping |
501 | sprintf(passwd_path, "%s/etc/passwd", rootdir); | 515 | sprintf(passwd_path, "%s/etc/passwd", rootdir); |
502 | sprintf(group_path, "%s/etc/group", rootdir); | 516 | sprintf(group_path, "%s/etc/group", rootdir); |