about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/if_index.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/if_index.c')
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index c8eefa9b98..f64fe1e1ca 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -182,11 +182,9 @@ if_indextoname (unsigned int ifindex, char *ifname)
 #else
   struct if_nameindex *idx = if_nameindex ();
   struct if_nameindex *p;
-  char *result;
+  char *result = NULL;
 
-  if (idx == NULL)
-    result = NULL;
-  else
+  if (idx != NULL)
     {
       for (p = idx; p->if_index || p->if_name; ++p)
 	if (p->if_index == ifindex)