aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/makedevs
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/makedevs')
-rw-r--r--meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c18
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)
static struct option long_options[] = {
{"root", 1, NULL, 'r'},
{"help", 0, NULL, 'h'},
- {"squash", 0, NULL, 'q'},
{"version", 0, NULL, 'v'},
{"devtable", 1, NULL, 'D'},
{NULL, 0, NULL, 0}
@@ -446,7 +445,6 @@ static char *helptext =
"Options:\n"
" -r, -d, --root=DIR Build filesystem from directory DIR (default: cwd)\n"
" -D, --devtable=FILE Use the named FILE as a device table file\n"
- " -q, --squash Squash permissions and owners making all files be owned by root\n"
" -h, --help Display this help text\n"
" -v, --version Display version information\n\n";
@@ -463,9 +461,15 @@ int main(int argc, char **argv)
FILE *passwd_file = NULL;
FILE *group_file = NULL;
FILE *devtable = NULL;
+ DIR *dir = NULL;
umask (0);
+ if (argc==1) {
+ fprintf(stderr, helptext);
+ exit(1);
+ }
+
while ((opt = getopt_long(argc, argv, "D:d:r:qhv",
long_options, &c)) >= 0) {
switch (opt) {
@@ -484,6 +488,11 @@ int main(int argc, char **argv)
if (rootdir != default_rootdir) {
error_msg_and_die("root directory specified more than once");
}
+ if ((dir = opendir(optarg)) == NULL) {
+ perror_msg_and_die(optarg);
+ } else {
+ closedir(dir);
+ }
rootdir = xstrdup(optarg);
break;
@@ -497,6 +506,11 @@ int main(int argc, char **argv)
}
}
+ if (argv[optind] != NULL) {
+ fprintf(stderr, helptext);
+ exit(1);
+ }
+
// Get name-id mapping
sprintf(passwd_path, "%s/etc/passwd", rootdir);
sprintf(group_path, "%s/etc/group", rootdir);