Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102983637
D40425.id122859.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D40425.id122859.diff
View Options
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -124,7 +124,6 @@
int ch, Jflag, nargs, nflag, nline;
size_t linelen;
struct rlimit rl;
- char *endptr;
const char *errstr;
inpline = replstr = NULL;
@@ -175,23 +174,23 @@
replstr = optarg;
break;
case 'L':
- Lflag = strtonum(optarg, 0, INT_MAX, &errstr);
+ Lflag = (int)strtonum(optarg, 0, INT_MAX, &errstr);
if (errstr)
- errx(1, "-L %s: %s", optarg, errstr);
+ errx(1, "-%c %s: %s", ch, optarg, errstr);
break;
case 'n':
nflag = 1;
- nargs = strtonum(optarg, 1, INT_MAX, &errstr);
+ nargs = (int)strtonum(optarg, 1, INT_MAX, &errstr);
if (errstr)
- errx(1, "-n %s: %s", optarg, errstr);
+ errx(1, "-%c %s: %s", ch, optarg, errstr);
break;
case 'o':
oflag = 1;
break;
case 'P':
- maxprocs = strtonum(optarg, 0, INT_MAX, &errstr);
+ maxprocs = (int)strtonum(optarg, 0, INT_MAX, &errstr);
if (errstr)
- errx(1, "-P %s: %s", optarg, errstr);
+ errx(1, "-%c %s: %s", ch, optarg, errstr);
if (getrlimit(RLIMIT_NPROC, &rl) != 0)
errx(1, "getrlimit failed");
if (maxprocs == 0 || maxprocs > rl.rlim_cur)
@@ -201,22 +200,22 @@
pflag = 1;
break;
case 'R':
- Rflag = strtol(optarg, &endptr, 10);
- if (*endptr != '\0')
- errx(1, "replacements must be a number");
+ Rflag = (int)strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "-%c %s: %s", ch, optarg, errstr);
break;
case 'r':
/* GNU compatibility */
break;
case 'S':
- Sflag = strtoul(optarg, &endptr, 10);
- if (*endptr != '\0')
- errx(1, "replsize must be a number");
+ Sflag = (int)strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "-%c %s: %s", ch, optarg, errstr);
break;
case 's':
- nline = strtonum(optarg, 0, INT_MAX, &errstr);
+ nline = (int)strtonum(optarg, 0, INT_MAX, &errstr);
if (errstr)
- errx(1, "-s %s: %s", optarg, errstr);
+ errx(1, "-%c %s: %s", ch, optarg, errstr);
break;
case 't':
tflag = 1;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 11:41 AM (22 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14737414
Default Alt Text
D40425.id122859.diff (2 KB)
Attached To
Mode
D40425: xargs: Consistently use strtonum() to parse arguments.
Attached
Detach File
Event Timeline
Log In to Comment