Skip to contentSkip to conversation

ipset-translate: allow invoking with a path name

PATCH Applied Quentin Armitage 2 participants 2 messages Aug 11, 2022 – Aug 16, 2022 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipset-translate: allow invoking with a path name

---
 src/ipset.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/ipset.c +3 -1
index 6d42b60..e53ffb1 100644
@@ -6,6 +6,8 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#define _GNU_SOURCE
+
 #include <assert.h>			/* assert */
 #include <stdio.h>			/* fprintf */
 #include <stdlib.h>			/* exit */
@@ -31,7 +33,7 @@ main(int argc, char *argv[])
 		exit(1);
 	}
 
-	if (!strcmp(argv[0], "ipset-translate")) {
+	if (!strcmp(basename(argv[0]), "ipset-translate")) {
 		ret = ipset_xlate_argv(ipset, argc, argv);
 	} else {
 		ret = ipset_parse_argv(ipset, argc, argv);
Signature · 1 line
2.34.3
maintainer Applied
#1 lore raw

Applied, thanks.

Quoted 30 lines · Quentin Armitage
---
 src/ipset.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/ipset.c +3 -1
index 6d42b60..e53ffb1 100644
@@ -6,6 +6,8 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#define _GNU_SOURCE
+
 #include <assert.h>			/* assert */
 #include <stdio.h>			/* fprintf */
 #include <stdlib.h>			/* exit */
@@ -31,7 +33,7 @@ main(int argc, char *argv[])
 		exit(1);
 	}
 
-	if (!strcmp(argv[0], "ipset-translate")) {
+	if (!strcmp(basename(argv[0]), "ipset-translate")) {
 		ret = ipset_xlate_argv(ipset, argc, argv);
 	} else {
 		ret = ipset_parse_argv(ipset, argc, argv);
Signature · 1 line
2.34.3