From 1c2da25573fce96e92e3f1deee7f0a0f57a3f83d Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 22 Apr 2018 17:35:36 +0200 Subject: [PATCH] Handle return value for truncate() - only for debugging anyway.. --- src/ircd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ircd.c b/src/ircd.c index 0e4099713..0f9bbe746 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -1627,7 +1627,8 @@ static void open_debugfile(void) /*(void)printf("isatty = %d ttyname = %#x\n", isatty(2), (u_int)ttyname(2)); */ if (!(bootopt & BOOT_TTY)) { /* leave debugging output on fd 2 */ - (void)truncate(LOGFILE, 0); + if (truncate(LOGFILE, 0) < 0) + fprintf(stderr, "WARNING: could not truncate log file '%s'\n", LOGFILE); if ((fd = open(LOGFILE, O_WRONLY | O_CREAT, 0600)) < 0) if ((fd = open("/dev/null", O_WRONLY)) < 0) exit(-1);