odhcpd: fix extra compiler warning
authorHans Dedecker <dedeckeh@gmail.com>
Sat, 3 Apr 2021 19:11:16 +0000 (21:11 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 3 Apr 2021 19:13:26 +0000 (21:13 +0200)
src/odhcpd.c:143:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  snprintf(buf, sizeof(buf), sysctl_pattern, ifname, what);
  ^~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/odhcpd.c

index 04a8054264f66eab9ab07ef6709efe22f144d359..9797507db27fc2f00569de3507f57f11683643c1 100644 (file)
@@ -139,8 +139,8 @@ int main(int argc, char **argv)
 int odhcpd_get_interface_config(const char *ifname, const char *what)
 {
        char buf[64];
-       const char *sysctl_pattern = "/proc/sys/net/ipv6/conf/%s/%s";
-       snprintf(buf, sizeof(buf), sysctl_pattern, ifname, what);
+       
+       snprintf(buf, sizeof(buf), "/proc/sys/net/ipv6/conf/%s/%s", ifname, what);
 
        int fd = open(buf, O_RDONLY);
        if (fd < 0)