check ioctl() call return value in tun_new()
Coverity complains about a missing ioctl() return value check. Check for failure of the TUNSETNOCSUM ioctl and log a warning if it fails. Change-Id: I88da2164d975d7a232619b8d31c5eadeef0f3a80 Related: CID#57661
This commit is contained in:
parent
fb75adfeda
commit
aee905b790
|
@ -193,7 +193,10 @@ int tun_new(struct tun_t **tun, const char *dev_name, bool use_kernel, int fd0,
|
||||||
strncpy((*tun)->devname, ifr.ifr_name, IFNAMSIZ);
|
strncpy((*tun)->devname, ifr.ifr_name, IFNAMSIZ);
|
||||||
(*tun)->devname[IFNAMSIZ - 1] = 0;
|
(*tun)->devname[IFNAMSIZ - 1] = 0;
|
||||||
|
|
||||||
ioctl((*tun)->fd, TUNSETNOCSUM, 1); /* Disable checksums */
|
/* Disable checksums */
|
||||||
|
if (ioctl((*tun)->fd, TUNSETNOCSUM, 1) < 0) {
|
||||||
|
SYS_ERR(DTUN, LOGL_NOTICE, errno, "could not disable checksum on %s", (*tun)->devname);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
strncpy((*tun)->devname, dev_name, IFNAMSIZ);
|
strncpy((*tun)->devname, dev_name, IFNAMSIZ);
|
||||||
|
|
Loading…
Reference in New Issue