aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/crond.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-08-04 10:16:59 -0500
committerRob Landley <rob@landley.net>2016-08-04 10:16:59 -0500
commit027a73a903af306449710ce12bc09e0e3550c6c9 (patch)
treea415cb11fa6f2b34e63b8259fc52342aaa8fec75 /toys/pending/crond.c
parent145b7024b5fbb74f16d5e403fb004ff8209bc4a0 (diff)
downloadtoybox-027a73a903af306449710ce12bc09e0e3550c6c9.tar.gz
Make xopen() skip stdin/stdout/stderr, add xopen_stdio() if you want stdout,
add xopenro() that takes one argument and understands "-" means stdin, and switch over lots of users.
Diffstat (limited to 'toys/pending/crond.c')
-rw-r--r--toys/pending/crond.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/pending/crond.c b/toys/pending/crond.c
index 1b5e4194..df8b5f11 100644
--- a/toys/pending/crond.c
+++ b/toys/pending/crond.c
@@ -79,10 +79,11 @@ static void loginfo(uint8_t loglevel, char *msg, ...)
if (!TT.flagd && TT.logfile) {
int fd = open(TT.logfile, O_WRONLY | O_CREAT | O_APPEND, 0666);
- if (fd >=0 && fd != 2) {
+ if (fd==-1) perror_msg("'%s", TT.logfile);
+ else {
dup2(fd, 2);
close(fd);
- } else if (fd < 0) perror_msg("'%s", TT.logfile);
+ }
}
used = vsnprintf(NULL, 0, msg, d);
smsg = xzalloc(++used);