diff --git a/ct/ct.c b/ct/ct.c index e7b4e15..b797057 100644 --- a/ct/ct.c +++ b/ct/ct.c @@ -323,8 +323,8 @@ runbenchn(Benchmark *b, int n) ctstarttimer(); b->f(n); ctstoptimer(); - write(durfd, &bdur, sizeof bdur); - write(durfd, &bbytes, sizeof bbytes); + if (write(durfd, &bdur, sizeof bdur)); + if (write(durfd, &bbytes, sizeof bbytes)); exit(0); } setpgid(pid, pid); @@ -540,7 +540,7 @@ writetokens(int n) if (wjobfd >= 0) { fcntl(wjobfd, F_SETFL, fcntl(wjobfd, F_GETFL)|O_NONBLOCK); for (; n>1; n--) { - write(wjobfd, &c, 1); /* ignore error; nothing we can do anyway */ + if (write(wjobfd, &c, 1)); /* ignore error; nothing we can do anyway */ } } } diff --git a/file.c b/file.c index e55a9c0..4211ea1 100644 --- a/file.c +++ b/file.c @@ -533,7 +533,7 @@ filewclose(File *f) if (!f) return; if (!f->iswopen) return; if (f->free) { - (void)ftruncate(f->fd, f->w->filesize - f->free); + if (ftruncate(f->fd, f->w->filesize - f->free)); } close(f->fd); f->iswopen = 0; diff --git a/sd-daemon.c b/sd-daemon.c index 8596961..3b46942 100644 --- a/sd-daemon.c +++ b/sd-daemon.c @@ -355,7 +355,8 @@ int sd_notify(int unset_environment, const char *state) { memset(&sockaddr, 0, sizeof(sockaddr)); sockaddr.sa.sa_family = AF_UNIX; - strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); + strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path) - 1); + sockaddr.un.sun_path[sizeof(sockaddr.un.sun_path) - 1] = '\0'; if (sockaddr.un.sun_path[0] == '@') sockaddr.un.sun_path[0] = 0;