aboutsummaryrefslogtreecommitdiff
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
parent41d8134511d93f5bcfa7ccadb6de6c553f90422e (diff)
downloadbusybox-w32-f15620c3774c164ee6c1e2fbf9dd481b606a95a1.tar.gz
busybox-w32-f15620c3774c164ee6c1e2fbf9dd481b606a95a1.tar.bz2
busybox-w32-f15620c3774c164ee6c1e2fbf9dd481b606a95a1.zip
shell/ulimit: code shrink by 10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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)
175 opt_char = 'f'; 175 opt_char = 'f';
176 for (l = limits_tbl; l != &limits_tbl[ARRAY_SIZE(limits_tbl)]; l++) { 176 for (l = limits_tbl; l != &limits_tbl[ARRAY_SIZE(limits_tbl)]; l++) {
177 if (opt_char == l->option) { 177 if (opt_char == l->option) {
178 char *val_str = optarg ? optarg : (argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL); 178 char *val_str;
179 179
180 getrlimit(l->cmd, &limit); 180 getrlimit(l->cmd, &limit);
181
182 val_str = optarg;
183 if (!val_str && argv[optind] && argv[optind][0] != '-')
184 val_str = argv[optind++]; /* ++ skips NN in "-c NN" case */
181 if (val_str) { 185 if (val_str) {
182 rlim_t val; 186 rlim_t val;
183 187
184 if (!optarg) /* -c NNN: make getopt skip NNN */
185 optind++;
186
187 if (strcmp(val_str, "unlimited") == 0) 188 if (strcmp(val_str, "unlimited") == 0)
188 val = RLIM_INFINITY; 189 val = RLIM_INFINITY;
189 else { 190 else {