aboutsummaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-08-21 11:18:25 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-08-21 11:18:25 +0000
commit72b6a65b2fab7325767ce72fc71b9cf45514764a (patch)
tree32b07c774b100d09c02a3e74445aeb37a33cab79 /runit
parentd6e81c7762e20e3df4d12c5515354e4da3a451a8 (diff)
downloadbusybox-72b6a65b2fab7325767ce72fc71b9cf45514764a.tar.gz
busybox-72b6a65b2fab7325767ce72fc71b9cf45514764a.tar.bz2
httpd: fix buglet in hex conversion. Remove alloca NULL checks
(never happens, app just crashes if stack overflows) svlogd: cosmetic messages and style fixes
Diffstat (limited to 'runit')
-rw-r--r--runit/svlogd.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c
index b8fa5645b..6c8747e96 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -513,22 +513,25 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
/* read config */
i = open_read_close("config", buf, sizeof(buf));
if (i < 0 && errno != ENOENT)
- bb_perror_msg(WARNING": %s/config", ld->name);
+ bb_perror_msg(WARNING"%s/config", ld->name);
if (i > 0) {
if (verbose)
bb_error_msg(INFO"read: %s/config", ld->name);
s = buf;
while (s) {
np = strchr(s, '\n');
- if (np) *np++ = '\0';
+ if (np)
+ *np++ = '\0';
switch (s[0]) {
case '+':
case '-':
case 'e':
case 'E':
+ /* Add '\n'-terminated line to ld->inst */
while (1) {
- int l = asprintf(&new, "%s%s\n", ld->inst?:"", s);
- if (l >= 0 && new) break;
+ int l = asprintf(&new, "%s%s\n", ld->inst ? : "", s);
+ if (l >= 0 && new)
+ break;
pause_nomem();
}
free(ld->inst);
@@ -578,7 +581,8 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
s = ld->inst;
while (s) {
np = strchr(s, '\n');
- if (np) *np++ = '\0';
+ if (np)
+ *np++ = '\0';
s = np;
}
}
@@ -586,7 +590,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
/* open current */
i = stat("current", &st);
if (i != -1) {
- if (st.st_size && ! (st.st_mode & S_IXUSR)) {
+ if (st.st_size && !(st.st_mode & S_IXUSR)) {
ld->fnsave[25] = '.';
ld->fnsave[26] = 'u';
ld->fnsave[27] = '\0';
@@ -600,8 +604,9 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
rmoldest(ld);
i = -1;
} else {
- /* Be paranoid: st.st_size can be not just bigger, but WIDER! */
- /* (bug in original svlogd. remove this comment when fixed there) */
+ /* st.st_size can be not just bigger, but WIDER!
+ * This code is safe: if st.st_size > 4GB, we select
+ * ld->sizemax (because it's "unsigned") */
ld->size = (st.st_size > ld->sizemax) ? ld->sizemax : st.st_size;
}
} else {
@@ -667,7 +672,7 @@ static int buffer_pread(int fd, char *s, unsigned len)
int i;
input.fd = 0;
- input.events = POLLIN|POLLHUP|POLLERR;
+ input.events = POLLIN;
do {
if (rotateasap) {
@@ -744,7 +749,6 @@ static int buffer_pread(int fd, char *s, unsigned len)
return i;
}
-
static void sig_term_handler(int sig_no)
{
if (verbose)