| Index: fusl/src/network/if_indextoname.c
|
| diff --git a/fusl/src/network/if_indextoname.c b/fusl/src/network/if_indextoname.c
|
| index 6ee7f13ce38ee10f1d32f7c9f266b9da2544beff..26a33b13de350d26fe8ef4e8a2406a7fb22e3829 100644
|
| --- a/fusl/src/network/if_indextoname.c
|
| +++ b/fusl/src/network/if_indextoname.c
|
| @@ -5,14 +5,14 @@
|
| #include <string.h>
|
| #include "syscall.h"
|
|
|
| -char *if_indextoname(unsigned index, char *name)
|
| -{
|
| - struct ifreq ifr;
|
| - int fd, r;
|
| +char* if_indextoname(unsigned index, char* name) {
|
| + struct ifreq ifr;
|
| + int fd, r;
|
|
|
| - if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return 0;
|
| - ifr.ifr_ifindex = index;
|
| - r = ioctl(fd, SIOCGIFNAME, &ifr);
|
| - __syscall(SYS_close, fd);
|
| - return r < 0 ? 0 : strncpy(name, ifr.ifr_name, IF_NAMESIZE);
|
| + if ((fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
|
| + return 0;
|
| + ifr.ifr_ifindex = index;
|
| + r = ioctl(fd, SIOCGIFNAME, &ifr);
|
| + __syscall(SYS_close, fd);
|
| + return r < 0 ? 0 : strncpy(name, ifr.ifr_name, IF_NAMESIZE);
|
| }
|
|
|