]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/commitdiff
misc-progs: Fix compilation with GCC 14
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 5 Aug 2024 16:47:22 +0000 (16:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 19 Aug 2024 10:01:01 +0000 (10:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/misc-progs/openvpnctrl.c
src/misc-progs/wioscan.c
src/misc-progs/wirelessclient.c

index 0659aa6b14fd174a0b0e4376f8d86083e45ffbb2..8de6eec5cbe9d34596e386c0de85b867e7549c1d 100644 (file)
@@ -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;
        }
index 206456c5dd386696ee379d101e1f16937e497163..e3c1633164fb2eccbe107849acf35c97eeaf2eb5 100644 (file)
@@ -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
+}
index c85e5316fae1339d1bae618b87c14e61ec3bd5ab..9510282d936d5add52e37134011cd6243f3e2832 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "setuid.h"
 
 int main(int argc, char *argv[]) {