Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- src/misc-progs/openvpnctrl.c | 17 +++++++++-------- src/misc-progs/wioscan.c | 4 ++-- src/misc-progs/wirelessclient.c | 1 + 3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/misc-progs/openvpnctrl.c b/src/misc-progs/openvpnctrl.c index 0659aa6b1..8de6eec5c 100644 --- a/src/misc-progs/openvpnctrl.c +++ b/src/misc-progs/openvpnctrl.c @@ -1,3 +1,4 @@ +#define _DEFAULT_SOURCE #define _XOPEN_SOURCE 500 #include <signal.h> #include <stdio.h> @@ -130,13 +131,13 @@ connection *getConnections() { conn_last = conn_curr;
count = 0; - char *lineptr = &line; + char *lineptr = line; while (1) { - if (*lineptr == NULL) + if (*lineptr == '\0') break;
resultptr = result; - while (*lineptr != NULL) { + while (*lineptr != '\0') { if (*lineptr == ',') { lineptr++; break; @@ -338,7 +339,7 @@ char* getLocalSubnetAddress(const connection* conn) { }
const char *zones[] = {"GREEN", "BLUE", "ORANGE", NULL}; - char *zone = NULL; + const char *zone = NULL;
// Get net address of the local openvpn subnet. char *subnetmask = strdup(conn->local_subnet); @@ -458,7 +459,7 @@ void setFirewallRules(void) { }
static void stopAuthenticator() { - const char* argv[] = { + char* argv[] = { "/usr/sbin/openvpn-authenticator", NULL, }; @@ -473,7 +474,7 @@ void stopDaemon(void) { stopAuthenticator();
int pid = readPidFile("/var/run/openvpn.pid"); - if (!pid > 0) { + if (pid <= 0) { exit(1); }
@@ -485,7 +486,7 @@ void stopDaemon(void) { }
static int startAuthenticator(void) { - const char* argv[] = { "-d", NULL }; + char* argv[] = { "-d", NULL };
return run("/usr/sbin/openvpn-authenticator", argv); } @@ -595,7 +596,7 @@ int killNet2Net(char *name) { snprintf(pidfile, STRING_SIZE - 1, "/var/run/%sn2n.pid", conn->name);
int pid = readPidFile(pidfile); - if (!pid > 0) { + if (pid <= 0) { fprintf(stderr, "Could not read pid file of connection %s.", conn->name); return 1; } diff --git a/src/misc-progs/wioscan.c b/src/misc-progs/wioscan.c index 206456c5d..e3c163316 100644 --- a/src/misc-progs/wioscan.c +++ b/src/misc-progs/wioscan.c @@ -76,7 +76,7 @@ struct hwaddr { u8 len, addr[HWMAX]; };
-static inline hw_eq(struct hwaddr *h, int hl, u8 *ha) +static inline int hw_eq(struct hwaddr *h, int hl, u8 *ha) { return h->len == hl && memcmp(h->addr, ha, hl) == 0; } @@ -662,4 +662,4 @@ print: q = p + 11; goto print; } -} \ No newline at end of file +} diff --git a/src/misc-progs/wirelessclient.c b/src/misc-progs/wirelessclient.c index c85e5316f..9510282d9 100644 --- a/src/misc-progs/wirelessclient.c +++ b/src/misc-progs/wirelessclient.c @@ -6,6 +6,7 @@
#include <stdio.h> #include <stdlib.h> +#include <string.h> #include "setuid.h"
int main(int argc, char *argv[]) {