summaryrefslogtreecommitdiff
path: root/pcr-testing/beanstalkd/fix-warnings.patch
blob: 865c3781fbde665cb312ab430b931c91cca0a1ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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;