]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wext: Avoid gcc warnings on restricted pointer aliasing
authorJouni Malinen <jouni@codeaurora.org>
Tue, 15 May 2018 17:40:24 +0000 (20:40 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 15 May 2018 22:16:54 +0000 (01:16 +0300)
The first two parameters to readlink() are marked restricted and at
least gcc 8.2 warns about used the same pointer for then, so avoid this
by using separate buffers for the pathname and response buffer.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/drivers/driver_wext.c

index 659eda2f1e92ffe8cc7ed65393aaa320e980e861..933b8d986efc94f774ae5bab6e16460a2772c9a0 100644 (file)
@@ -922,7 +922,7 @@ static int wext_add_hostap(struct wpa_driver_wext_data *drv)
 
 static void wext_check_hostap(struct wpa_driver_wext_data *drv)
 {
-       char buf[200], *pos;
+       char path[200], buf[200], *pos;
        ssize_t res;
 
        /*
@@ -937,9 +937,9 @@ static void wext_check_hostap(struct wpa_driver_wext_data *drv)
         */
 
        /* First, try to see if driver information is available from sysfs */
-       snprintf(buf, sizeof(buf), "/sys/class/net/%s/device/driver",
+       snprintf(path, sizeof(path), "/sys/class/net/%s/device/driver",
                 drv->ifname);
-       res = readlink(buf, buf, sizeof(buf) - 1);
+       res = readlink(path, buf, sizeof(buf) - 1);
        if (res > 0) {
                buf[res] = '\0';
                pos = strrchr(buf, '/');