diff options
author | 2018-01-16 20:40:43 +0000 | |
---|---|---|
committer | 2018-01-16 20:40:43 +0000 | |
commit | 2bd0d27d2ba67e461674ee1a957c1eee27e369ec (patch) | |
tree | 6588e37b44f8f8e5058fe6ad56f1c31f82c16812 | |
parent | garbage collect an unused variable (diff) | |
download | wireguard-openbsd-2bd0d27d2ba67e461674ee1a957c1eee27e369ec.tar.xz wireguard-openbsd-2bd0d27d2ba67e461674ee1a957c1eee27e369ec.zip |
Stop constructing the ulimit optstring passed to ksh_getopt() at runtime since
it's rarely subject to change. While here, unifdef RLIMIT_VMEM.
ok jca@
-rw-r--r-- | bin/ksh/c_ulimit.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/bin/ksh/c_ulimit.c b/bin/ksh/c_ulimit.c index e44c480ffdd..e8f9c208dee 100644 --- a/bin/ksh/c_ulimit.c +++ b/bin/ksh/c_ulimit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_ulimit.c,v 1.24 2015/12/14 13:59:42 tb Exp $ */ +/* $OpenBSD: c_ulimit.c,v 1.25 2018/01/16 20:40:43 anton Exp $ */ /* ulimit -- handle "ulimit" builtin @@ -53,27 +53,13 @@ c_ulimit(char **wp) { "memory(kbytes)", RLIMIT_RSS, 1024, 'm' }, { "nofiles(descriptors)", RLIMIT_NOFILE, 1, 'n' }, { "processes", RLIMIT_NPROC, 1, 'p' }, -#ifdef RLIMIT_VMEM - { "vmemory(kbytes)", RLIMIT_VMEM, 1024, 'v' }, -#endif /* RLIMIT_VMEM */ { NULL } }; - static char options[4 + NELEM(limits) * 2]; + const char *options = "HSat#f#c#d#s#l#m#n#p#"; int how = SOFT | HARD; const struct limits *l; int optc, all = 0; - if (!options[0]) { - /* build options string on first call - yuck */ - char *p = options; - - *p++ = 'H'; *p++ = 'S'; *p++ = 'a'; - for (l = limits; l->name; l++) { - *p++ = l->option; - *p++ = '#'; - } - *p = '\0'; - } /* First check for -a, -H and -S. */ while ((optc = ksh_getopt(wp, &builtin_opt, options)) != -1) switch (optc) { |