* GNU General Public License for more details.
*/
+#define _ISOC99_SOURCE
+#define _BSD_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
mhdr.status = WPROBE_MSG_DATA;
mhdr.len = buflen;
wprobe_swap_msg_hdr(&mhdr);
- write(socket, &mhdr, sizeof(mhdr));
+ ret = write(socket, &mhdr, sizeof(mhdr));
+ if (ret < 0)
+ goto out;
memcpy(buf, nlh, buflen);
nlh = buf;
swap_genlmsghdr(gnlh);
swap_nlmsghdr(nlh);
ret = write(socket, buf, buflen);
+
+out:
free(buf);
return ret;
free(devstr);
return wprobe_get_dev(arg);
#else
- *err = "Invalid argument";
+ if (err)
+ *err = "Invalid argument";
goto out;
#endif
}