From patchwork Mon Aug 19 10:05:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8020 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4WnSt45w0qz3xGD for ; Mon, 19 Aug 2024 10:06:20 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4WnSt12jr4z5ZF; Mon, 19 Aug 2024 10:06:17 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4WnSt128Tcz344x; Mon, 19 Aug 2024 10:06:17 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4WnSst5mKgz342b for ; Mon, 19 Aug 2024 10:06:10 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4WnSst2dQtz3vW; Mon, 19 Aug 2024 10:06:10 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4WnSss66dwzTkH6; Mon, 19 Aug 2024 10:06:09 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 06/19] misc-progs: Fix compilation with GCC 14 Date: Mon, 19 Aug 2024 10:05:55 +0000 Message-Id: <20240819100608.991138-7-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240819100608.991138-1-michael.tremer@ipfire.org> References: <20240819100608.991138-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: YCJGJ5AC7OFXV3FL6BB6BQZX4F6XIHFZ X-Message-ID-Hash: YCJGJ5AC7OFXV3FL6BB6BQZX4F6XIHFZ X-MailFrom: root@michael.haj.ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Michael Tremer X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Michael Tremer --- 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 #include @@ -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 #include +#include #include "setuid.h" int main(int argc, char *argv[]) {