From: Diego Nieto Cid <[email protected]>
../../lwip/port/netif/hurdtunif.c: In function 'hurdtunif_device_init':
../../lwip/port/netif/hurdtunif.c:208:5: warning: ignoring return value of
'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result]
208 | asprintf (&tunif->comm.devname, "/dev/%s", base_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
lwip/port/netif/hurdtunif.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lwip/port/netif/hurdtunif.c b/lwip/port/netif/hurdtunif.c
index 456dd297..54d4a0a3 100644
--- a/lwip/port/netif/hurdtunif.c
+++ b/lwip/port/netif/hurdtunif.c
@@ -202,10 +202,16 @@ hurdtunif_device_init (struct netif *netif)
base_name = name;
if (base_name != name)
- tunif->comm.devname = strdup (name);
+ tunif->comm.devname = strdup (name), err = (tunif->comm.devname == 0 ? -1
: 0);
else
/* Setting up the translator at /dev/tunX. */
- asprintf (&tunif->comm.devname, "/dev/%s", base_name);
+ err = asprintf (&tunif->comm.devname, "/dev/%s", base_name);
+
+ if (err == -1)
+ {
+ LWIP_DEBUGF (NETIF_DEBUG, ("hurdtunif_init: out of memory\n"));
+ return ERR_MEM;
+ }
/* Set the device type */
tunif->comm.type = ARPHRD_TUNNEL;
--
2.51.0