fix-warnings.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. diff --git a/ct/ct.c b/ct/ct.c
  2. index e7b4e15..b797057 100644
  3. --- a/ct/ct.c
  4. +++ b/ct/ct.c
  5. @@ -323,8 +323,8 @@ runbenchn(Benchmark *b, int n)
  6. ctstarttimer();
  7. b->f(n);
  8. ctstoptimer();
  9. - write(durfd, &bdur, sizeof bdur);
  10. - write(durfd, &bbytes, sizeof bbytes);
  11. + if (write(durfd, &bdur, sizeof bdur));
  12. + if (write(durfd, &bbytes, sizeof bbytes));
  13. exit(0);
  14. }
  15. setpgid(pid, pid);
  16. @@ -540,7 +540,7 @@ writetokens(int n)
  17. if (wjobfd >= 0) {
  18. fcntl(wjobfd, F_SETFL, fcntl(wjobfd, F_GETFL)|O_NONBLOCK);
  19. for (; n>1; n--) {
  20. - write(wjobfd, &c, 1); /* ignore error; nothing we can do anyway */
  21. + if (write(wjobfd, &c, 1)); /* ignore error; nothing we can do anyway */
  22. }
  23. }
  24. }
  25. diff --git a/file.c b/file.c
  26. index e55a9c0..4211ea1 100644
  27. --- a/file.c
  28. +++ b/file.c
  29. @@ -533,7 +533,7 @@ filewclose(File *f)
  30. if (!f) return;
  31. if (!f->iswopen) return;
  32. if (f->free) {
  33. - (void)ftruncate(f->fd, f->w->filesize - f->free);
  34. + if (ftruncate(f->fd, f->w->filesize - f->free));
  35. }
  36. close(f->fd);
  37. f->iswopen = 0;
  38. diff --git a/sd-daemon.c b/sd-daemon.c
  39. index 8596961..3b46942 100644
  40. --- a/sd-daemon.c
  41. +++ b/sd-daemon.c
  42. @@ -355,7 +355,8 @@ int sd_notify(int unset_environment, const char *state) {
  43. memset(&sockaddr, 0, sizeof(sockaddr));
  44. sockaddr.sa.sa_family = AF_UNIX;
  45. - strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
  46. + strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path) - 1);
  47. + sockaddr.un.sun_path[sizeof(sockaddr.un.sun_path) - 1] = '\0';
  48. if (sockaddr.un.sun_path[0] == '@')
  49. sockaddr.un.sun_path[0] = 0;