+/*
+Copyright (c) 2001-2006, Gerrit Pape
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Busyboxed by Denis Vlasenko <vda.linux@googlemail.com> */
+/* Dependencies on runit_lib.c removed */
+
#include "busybox.h"
#include <dirent.h>
errno = 0;
d = readdir(dir);
if (!d) {
- if (errno) bb_perror_msg_and_die("readdir %s", directory_name);
+ if (errno)
+ bb_perror_msg_and_die("readdir %s",
+ directory_name);
break;
}
if (d->d_name[0] == '.') continue;
if (fd < 0) {
if ((errno == EISDIR) && env_dir) {
if (OPT_verbose)
- bb_perror_msg("warning: %s/%s is a directory", directory_name,
- d->d_name);
+ bb_perror_msg("warning: %s/%s is a directory",
+ directory_name, d->d_name);
continue;
} else
- bb_perror_msg_and_die("open %s/%s", directory_name, /* was exiting 111 */
- d->d_name);
+ bb_perror_msg_and_die("open %s/%s",
+ directory_name, d->d_name);
}
if (fd >= 0) {
char buf[256];
size = safe_read(fd, buf, sizeof(buf)-1);
if (size < 0)
- bb_perror_msg_and_die("read %s/%s", directory_name, /* was exiting 111 */
- d->d_name);
+ bb_perror_msg_and_die("read %s/%s",
+ directory_name, d->d_name);
if (size == 0) {
unsetenv(d->d_name);
continue;
#ifdef RLIMIT_DATA
limit(RLIMIT_DATA, limitd);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_DATA");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_DATA");
#endif
}
if (limits >= -1) {
#ifdef RLIMIT_STACK
limit(RLIMIT_STACK, limits);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_STACK");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_STACK");
#endif
}
if (limitl >= -1) {
#ifdef RLIMIT_MEMLOCK
limit(RLIMIT_MEMLOCK, limitl);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_MEMLOCK");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_MEMLOCK");
#endif
}
if (limita >= -1) {
limit(RLIMIT_AS, limita);
#else
if (OPT_verbose)
- bb_error_msg("system does not support %s", "RLIMIT_VMEM");
+ bb_error_msg("system does not support %s",
+ "RLIMIT_VMEM");
#endif
#endif
}
limit(RLIMIT_OFILE, limito);
#else
if (OPT_verbose)
- bb_error_msg("system does not support %s", "RLIMIT_NOFILE");
+ bb_error_msg("system does not support %s",
+ "RLIMIT_NOFILE");
#endif
#endif
}
#ifdef RLIMIT_NPROC
limit(RLIMIT_NPROC, limitp);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_NPROC");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_NPROC");
#endif
}
if (limitf >= -1) {
#ifdef RLIMIT_FSIZE
limit(RLIMIT_FSIZE, limitf);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_FSIZE");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_FSIZE");
#endif
}
if (limitc >= -1) {
#ifdef RLIMIT_CORE
limit(RLIMIT_CORE, limitc);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_CORE");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_CORE");
#endif
}
if (limitr >= -1) {
#ifdef RLIMIT_RSS
limit(RLIMIT_RSS, limitr);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_RSS");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_RSS");
#endif
}
if (limitt >= -1) {
#ifdef RLIMIT_CPU
limit(RLIMIT_CPU, limitt);
#else
- if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_CPU");
+ if (OPT_verbose) bb_error_msg("system does not support %s",
+ "RLIMIT_CPU");
#endif
}
}
{
char *m,*d,*o,*p,*f,*c,*r,*t,*n;
- getopt32(argc, argv, "u:U:e:m:d:o:p:f:c:r:t:/:n:vP012",
+ getopt32(argc, argv, "+u:U:e:m:d:o:p:f:c:r:t:/:n:vP012",
&set_user,&env_user,&env_dir,
&m,&d,&o,&p,&f,&c,&r,&t,&root,&n);
// if (option_mask32 & 0x1) // -u
static void softlimit(int argc, char **argv)
{
char *a,*c,*d,*f,*l,*m,*o,*p,*r,*s,*t;
- getopt32(argc, argv, "a:c:d:f:l:m:o:p:r:s:t:",
+ getopt32(argc, argv, "+a:c:d:f:l:m:o:p:r:s:t:",
&a,&c,&d,&f,&l,&m,&o,&p,&r,&s,&t);
if (option_mask32 & 0x001) limita = xatoul(a); // -a
if (option_mask32 & 0x002) limitc = xatoul(c); // -c