diff options
author | 2020-10-14 18:08:48 +0200 | |
---|---|---|
committer | 2020-10-14 18:08:48 +0200 | |
commit | dbcad5eb1a58e0ca8fb801bc8183150400f11c8a (patch) | |
tree | 5a9ae1a0f409b4a0b83abd0fcdb1e6b82da9417c /src | |
parent | build: enable CI build with scan-build (diff) | |
download | firejail-dbcad5eb1a58e0ca8fb801bc8183150400f11c8a.tar.gz firejail-dbcad5eb1a58e0ca8fb801bc8183150400f11c8a.tar.zst firejail-dbcad5eb1a58e0ca8fb801bc8183150400f11c8a.zip |
Remove unused variables
Fixes clang-analyzer warnings:
"Although the value stored to 'xxxxx' is used in the enclosing expression, the value is never actually read from 'xxxxx'"
Diffstat (limited to 'src')
-rw-r--r-- | src/faudit/dbus.c | 2 | ||||
-rw-r--r-- | src/firejail/arp.c | 8 | ||||
-rw-r--r-- | src/firejail/network.c | 3 | ||||
-rw-r--r-- | src/fnet/arp.c | 4 |
4 files changed, 6 insertions, 11 deletions
diff --git a/src/faudit/dbus.c b/src/faudit/dbus.c index beaa5ac46..2a3c282d7 100644 --- a/src/faudit/dbus.c +++ b/src/faudit/dbus.c | |||
@@ -91,7 +91,7 @@ static char *test_dbus_env(char *env_var_name) { | |||
91 | if (!found) | 91 | if (!found) |
92 | errExit("strdup"); | 92 | errExit("strdup"); |
93 | } | 93 | } |
94 | else if ((sockfile = strstr(bus, "tcp:host=")) != NULL) | 94 | else if (strstr(bus, "tcp:host=") != NULL) |
95 | printf("UGLY: %s bus configured for TCP communication.\n", env_var_name); | 95 | printf("UGLY: %s bus configured for TCP communication.\n", env_var_name); |
96 | else | 96 | else |
97 | printf("GOOD: cannot find a %s D-Bus socket\n", env_var_name); | 97 | printf("GOOD: cannot find a %s D-Bus socket\n", env_var_name); |
diff --git a/src/firejail/arp.c b/src/firejail/arp.c index f88d0a1dd..69d872110 100644 --- a/src/firejail/arp.c +++ b/src/firejail/arp.c | |||
@@ -105,8 +105,7 @@ void arp_announce(const char *dev, Bridge *br) { | |||
105 | if ((sock = socket(PF_PACKET, SOCK_RAW, htons (ETH_P_ALL))) < 0) | 105 | if ((sock = socket(PF_PACKET, SOCK_RAW, htons (ETH_P_ALL))) < 0) |
106 | errExit("socket"); | 106 | errExit("socket"); |
107 | 107 | ||
108 | int len; | 108 | if (sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr)) <= 0) |
109 | if ((len = sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr))) <= 0) | ||
110 | errExit("send"); | 109 | errExit("send"); |
111 | fflush(0); | 110 | fflush(0); |
112 | close(sock); | 111 | close(sock); |
@@ -177,8 +176,7 @@ int arp_check(const char *dev, uint32_t destaddr) { | |||
177 | if ((sock = socket(PF_PACKET, SOCK_RAW, htons (ETH_P_ALL))) < 0) | 176 | if ((sock = socket(PF_PACKET, SOCK_RAW, htons (ETH_P_ALL))) < 0) |
178 | errExit("socket"); | 177 | errExit("socket"); |
179 | 178 | ||
180 | int len; | 179 | if (sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr)) <= 0) |
181 | if ((len = sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr))) <= 0) | ||
182 | errExit("send"); | 180 | errExit("send"); |
183 | fflush(0); | 181 | fflush(0); |
184 | 182 | ||
@@ -201,7 +199,7 @@ int arp_check(const char *dev, uint32_t destaddr) { | |||
201 | close(sock); | 199 | close(sock); |
202 | return 0; | 200 | return 0; |
203 | } | 201 | } |
204 | if ((len = sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr))) <= 0) | 202 | if (sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr)) <= 0) |
205 | errExit("send"); | 203 | errExit("send"); |
206 | ts.tv_sec = 0; // 0.5 seconds wait time | 204 | ts.tv_sec = 0; // 0.5 seconds wait time |
207 | ts.tv_usec = 500000; | 205 | ts.tv_usec = 500000; |
diff --git a/src/firejail/network.c b/src/firejail/network.c index aa05e3bd0..8cdf04947 100644 --- a/src/firejail/network.c +++ b/src/firejail/network.c | |||
@@ -183,7 +183,6 @@ int net_add_route(uint32_t ip, uint32_t mask, uint32_t gw) { | |||
183 | int sock; | 183 | int sock; |
184 | struct rtentry route; | 184 | struct rtentry route; |
185 | struct sockaddr_in *addr; | 185 | struct sockaddr_in *addr; |
186 | int err = 0; | ||
187 | 186 | ||
188 | // create the socket | 187 | // create the socket |
189 | if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) | 188 | if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) |
@@ -205,7 +204,7 @@ int net_add_route(uint32_t ip, uint32_t mask, uint32_t gw) { | |||
205 | 204 | ||
206 | route.rt_flags = RTF_UP | RTF_GATEWAY; | 205 | route.rt_flags = RTF_UP | RTF_GATEWAY; |
207 | route.rt_metric = 0; | 206 | route.rt_metric = 0; |
208 | if ((err = ioctl(sock, SIOCADDRT, &route)) != 0) { | 207 | if (ioctl(sock, SIOCADDRT, &route) != 0) { |
209 | close(sock); | 208 | close(sock); |
210 | return -1; | 209 | return -1; |
211 | } | 210 | } |
diff --git a/src/fnet/arp.c b/src/fnet/arp.c index 122d0007c..64f177574 100644 --- a/src/fnet/arp.c +++ b/src/fnet/arp.c | |||
@@ -149,10 +149,8 @@ void arp_scan(const char *dev, uint32_t ifip, uint32_t ifmask) { | |||
149 | memcpy (frame + 14, &hdr, sizeof(hdr)); | 149 | memcpy (frame + 14, &hdr, sizeof(hdr)); |
150 | 150 | ||
151 | // send packet | 151 | // send packet |
152 | int len; | 152 | if (sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr)) <= 0) |
153 | if ((len = sendto (sock, frame, 14 + sizeof(ArpHdr), 0, (struct sockaddr *) &addr, sizeof (addr))) <= 0) | ||
154 | errExit("send"); | 153 | errExit("send"); |
155 | //printf("send %d bytes to %d.%d.%d.%d\n", len, PRINT_IP(dest)); | ||
156 | fflush(0); | 154 | fflush(0); |
157 | dest++; | 155 | dest++; |
158 | } | 156 | } |