- correct boilerplate
- use bb_xgetlarg for the patch_level to catch invalid arguments.
This commit is contained in:
parent
c9c959cc7c
commit
ee9cf48620
@ -3,7 +3,7 @@
|
|||||||
* busybox patch applet to handle the unified diff format.
|
* busybox patch applet to handle the unified diff format.
|
||||||
* Copyright (C) 2003 Glenn McGrath <bug1@iinet.net.au>
|
* Copyright (C) 2003 Glenn McGrath <bug1@iinet.net.au>
|
||||||
*
|
*
|
||||||
* Licensed under the GPL v2, see the file LICENSE in this tarball.
|
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||||
*
|
*
|
||||||
* This applet is written to work with patches generated by GNU diff,
|
* This applet is written to work with patches generated by GNU diff,
|
||||||
* where there is equivalent functionality busybox patch shall behave
|
* where there is equivalent functionality busybox patch shall behave
|
||||||
@ -99,7 +99,7 @@ extern int patch_main(int argc, char **argv)
|
|||||||
char *p, *i;
|
char *p, *i;
|
||||||
ret = bb_getopt_ulflags(argc, argv, "p:i:", &p, &i);
|
ret = bb_getopt_ulflags(argc, argv, "p:i:", &p, &i);
|
||||||
if (ret & 1)
|
if (ret & 1)
|
||||||
patch_level = atoi(p);
|
patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX);
|
||||||
if (ret & 2) {
|
if (ret & 2) {
|
||||||
patch_file = bb_xfopen(i, "r");
|
patch_file = bb_xfopen(i, "r");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user