From 9d6394679f075992b9902a7a3b4c2fe61819cb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gomez?= Date: Sun, 9 Jan 2022 18:25:44 +0100 Subject: [PATCH] sanitize: check return value --- src/bip_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bip_main.c b/src/bip_main.c index 0241b3d..8582d34 100644 --- a/src/bip_main.c +++ b/src/bip_main.c @@ -296,7 +296,10 @@ int main(int argc, char **argv) else pid = getpid(); snprintf(buf, (size_t) 29, "%lu\n", (unsigned long int)pid); - write(fd, buf, strlen(buf)); + ssize_t written; + written = write(fd, buf, strlen(buf)); + if (written <= 0) + mylog(LOG_ERROR, "Could not write to PID file"); close(fd); bip.listener = listen_new(conf_ip, conf_port, conf_css);