aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-08 23:28:30 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-08 23:28:30 +0100
commitf15620c3774c164ee6c1e2fbf9dd481b606a95a1 (patch)
treeb196bfa991811e2e45dae033b33a8daec9c47677 /shell
parent41d8134511d93f5bcfa7ccadb6de6c553f90422e (diff)
downloadbusybox-f15620c3774c164ee6c1e2fbf9dd481b606a95a1.tar.gz
shell/ulimit: code shrink by 10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/builtin_ulimit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/shell/builtin_ulimit.c b/shell/builtin_ulimit.c
index 7e8678341..9f9205eb6 100644
--- a/shell/builtin_ulimit.c
+++ b/shell/builtin_ulimit.c
@@ -175,15 +175,16 @@ int FAST_FUNC shell_builtin_ulimit(char **argv)
opt_char = 'f';
for (l = limits_tbl; l != &limits_tbl[ARRAY_SIZE(limits_tbl)]; l++) {
if (opt_char == l->option) {
- char *val_str = optarg ? optarg : (argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL);
+ char *val_str;
getrlimit(l->cmd, &limit);
+
+ val_str = optarg;
+ if (!val_str && argv[optind] && argv[optind][0] != '-')
+ val_str = argv[optind++]; /* ++ skips NN in "-c NN" case */
if (val_str) {
rlim_t val;
- if (!optarg) /* -c NNN: make getopt skip NNN */
- optind++;
-
if (strcmp(val_str, "unlimited") == 0)
val = RLIM_INFINITY;
else {