|
Lines 166-178
main(int argc, char *argv[])
Link Here
|
| 166 |
oflag = 1; |
166 |
oflag = 1; |
| 167 |
break; |
167 |
break; |
| 168 |
case 'P': |
168 |
case 'P': |
| 169 |
maxprocs = strtonum(optarg, 1, INT_MAX, &errstr); |
169 |
maxprocs = strtonum(optarg, 0, INT_MAX, &errstr); |
| 170 |
if (errstr) |
170 |
if (errstr) |
| 171 |
errx(1, "-P %s: %s", optarg, errstr); |
171 |
errx(1, "-P %s: %s", optarg, errstr); |
| 172 |
if (getrlimit(RLIMIT_NPROC, &rl) != 0) |
172 |
if (getrlimit(RLIMIT_NPROC, &rl) != 0) |
| 173 |
errx(1, "getrlimit failed"); |
173 |
errx(1, "getrlimit failed"); |
| 174 |
if (*endptr != '\0') |
|
|
| 175 |
errx(1, "invalid number for -P option"); |
| 176 |
if (maxprocs < 0) |
174 |
if (maxprocs < 0) |
| 177 |
errx(1, "value for -P option should be >= 0"); |
175 |
errx(1, "value for -P option should be >= 0"); |
| 178 |
if (maxprocs == 0 || maxprocs > rl.rlim_cur) |
176 |
if (maxprocs == 0 || maxprocs > rl.rlim_cur) |