char * if_indextoname(uint __ifindex,char *__ifname)
{
if_nameindex *piVar1;
int *piVar2;
int __fd;
int iVar3;
if_nameindex *__ptr;
if_nameindex *piVar4;
char *pcVar5;
int iVar6;
char acStack_40 [16];
uint local_30;
if (DAT_0041f9f0 == 0) {
piVar2 = __errno_location();
iVar6 = *piVar2;
__fd = FUN_00408250();
if (__fd < 0) {
return (char *)0x0;
}
local_30 = __ifindex;
iVar3 = ioctl(__fd,0x8910,acStack_40);
if (-1 < iVar3) {
close(__fd);
pcVar5 = strncpy(__ifname,acStack_40,0x10) //possible issue identified - semgrep
return pcVar5;
}
if (*piVar2 == 0x16) {
DAT_0041f9f0 = 1;
}
close(__fd);
*piVar2 = iVar6;
}
__ptr = if_nameindex();
piVar1 = __ptr;
if (__ptr == (if_nameindex *)0x0) {
pcVar5 = (char *)0x0;
}
else {
do {
piVar4 = piVar1;
if ((piVar4->if_index == 0) && (pcVar5 = (char *)0x0, piVar4->if_name == (char *)0x0))
goto LAB_004088f4;
piVar1 = piVar4 + 1;
} while (piVar4->if_index != __ifindex);
pcVar5 = strncpy(__ifname,piVar4->if_name,0x10) //possible issue identified - semgrep
LAB_004088f4:
if_freenameindex(__ptr);
}
return pcVar5;
}