aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/crond.c
diff options
context:
space:
mode:
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);