Package: socklog / 2.1.0+repack-4

0003-patches-fix-build-warnings.patch Patch series | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
From: Mathieu Mirmont <mat@parad0x.org>
Date: Sat, 7 Nov 2020 23:54:06 +0100
Subject: patches: fix build warnings

---
 src/chkshsgr.c     | 4 +++-
 src/pathexec.h     | 2 +-
 src/pathexec_run.c | 7 ++++---
 src/prot.c         | 3 +++
 src/seek_set.c     | 1 +
 src/socklog-conf.c | 2 +-
 src/socklog.c      | 5 +++--
 7 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/chkshsgr.c b/src/chkshsgr.c
index 38c352d..b3c8278 100644
--- a/src/chkshsgr.c
+++ b/src/chkshsgr.c
@@ -1,10 +1,12 @@
 /* Public domain. */
 
+#include <sys/types.h>
 #include <unistd.h>
+#include <grp.h>
 
 int main()
 {
-  short x[4];
+  gid_t x[2];
 
   x[0] = x[1] = 0;
   if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
diff --git a/src/pathexec.h b/src/pathexec.h
index 61da922..dd510d8 100644
--- a/src/pathexec.h
+++ b/src/pathexec.h
@@ -3,7 +3,7 @@
 #ifndef PATHEXEC_H
 #define PATHEXEC_H
 
-extern void pathexec_run(const char *,const char * const *,const char * const *);
+extern void pathexec_run(const char *, const char * const *, const char * const *);
 extern int pathexec_env(const char *,const char *);
 extern void pathexec(const char * const *);
 
diff --git a/src/pathexec_run.c b/src/pathexec_run.c
index 1770ac7..36ce0f8 100644
--- a/src/pathexec_run.c
+++ b/src/pathexec_run.c
@@ -1,5 +1,6 @@
 /* Public domain. */
 
+#include <unistd.h>
 #include "error.h"
 #include "stralloc.h"
 #include "str.h"
@@ -8,14 +9,14 @@
 
 static stralloc tmp;
 
-void pathexec_run(const char *file,const char * const *argv,const char * const *envp)
+void pathexec_run(const char *file, const char * const *argv, const char * const *envp)
 {
   const char *path;
   unsigned int split;
   int savederrno;
 
   if (file[str_chr(file,'/')]) {
-    execve(file,argv,envp);
+    execve(file,(char * const *)argv,(char * const *)envp);
     return;
   }
 
@@ -32,7 +33,7 @@ void pathexec_run(const char *file,const char * const *argv,const char * const *
     if (!stralloc_cats(&tmp,file)) return;
     if (!stralloc_0(&tmp)) return;
 
-    execve(tmp.s,argv,envp);
+    execve(tmp.s,(char * const *)argv,(char * const *)envp);
     if (errno != error_noent) {
       savederrno = errno;
       if ((errno != error_acces) && (errno != error_perm) && (errno != error_isdir)) return;
diff --git a/src/prot.c b/src/prot.c
index 79a88c5..99ed0cc 100644
--- a/src/prot.c
+++ b/src/prot.c
@@ -1,5 +1,8 @@
 /* Public domain. */
 
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
 #include "hasshsgr.h"
 #include "prot.h"
 
diff --git a/src/seek_set.c b/src/seek_set.c
index 19b8265..a1a36d0 100644
--- a/src/seek_set.c
+++ b/src/seek_set.c
@@ -1,6 +1,7 @@
 /* Public domain. */
 
 #include <sys/types.h>
+#include <unistd.h>
 #include "seek.h"
 
 #define SET 0 /* sigh */
diff --git a/src/socklog-conf.c b/src/socklog-conf.c
index 029816b..82284b5 100644
--- a/src/socklog-conf.c
+++ b/src/socklog-conf.c
@@ -73,7 +73,7 @@ void start(const char *s) {
   fn = s;
   fd = open_trunc(fn);
   if (fd == -1) fail();
-  buffer_init(&b, write, fd, buf, sizeof buf);
+  buffer_init(&b, (int (*)()) write, fd, buf, sizeof buf);
 }
 
 void outs(const char *s) {
diff --git a/src/socklog.c b/src/socklog.c
index babb9aa..93c784e 100644
--- a/src/socklog.c
+++ b/src/socklog.c
@@ -168,7 +168,8 @@ int socket_unix (const char* f) {
     strerr_die2sys(111, FATAL, "socket(): ");
   byte_zero(&sa, sizeof(sa));
   sa.sun_family =AF_UNIX;
-  strncpy(sa.sun_path, f, sizeof(sa.sun_path));
+  strncpy(sa.sun_path, f, sizeof(sa.sun_path) - 1);
+  sa.sun_path[sizeof(sa.sun_path) - 1] = '\0';
   unlink(f);
   if (! noumask) umask(0);
   if (bind(s, (struct sockaddr*) &sa, sizeof sa) == -1)
@@ -220,7 +221,7 @@ int read_socket (int s) {
 
   for(;;) {
     struct sockaddr_in saf;
-    int dummy =sizeof saf;
+    socklen_t dummy =sizeof saf;
     int linec;
     int os;