makedevs: rectify the exit codes and handle the invalid parameter
It is correct behaviours to output help and version information, and should return 0; When input parameter is invalid, print help information and exit. (From OE-Core rev: 7c61daa08fa51557e0e6785e738646cb5d8de91b) Signed-off-by: Roy Li <rongqing.li@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
66bf6562d2
commit
4312f5a534
|
@ -465,8 +465,8 @@ int main(int argc, char **argv)
|
||||||
error_msg_and_die("%s: not a proper device table file", optarg);
|
error_msg_and_die("%s: not a proper device table file", optarg);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf(stderr, helptext);
|
printf(helptext);
|
||||||
exit(1);
|
exit(0);
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'd': /* for compatibility with mkfs.jffs, genext2fs, etc... */
|
case 'd': /* for compatibility with mkfs.jffs, genext2fs, etc... */
|
||||||
if (rootdir != default_rootdir) {
|
if (rootdir != default_rootdir) {
|
||||||
|
@ -476,8 +476,11 @@ int main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
fprintf(stderr, "makedevs revision %.*s\n",
|
printf("makedevs revision %.*s\n",
|
||||||
(int) strlen(revtext) - 13, revtext + 11);
|
(int) strlen(revtext) - 13, revtext + 11);
|
||||||
|
exit(0);
|
||||||
|
default:
|
||||||
|
fprintf(stderr, helptext);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue