X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/768a38de0f1d2c703b619791417304a213c420c2..5c56c7216aa8f3ad2d9fe92e03ad21278bac5caa:/package/wprobe/src/user/wprobe-lib.c?ds=sidebyside diff --git a/package/wprobe/src/user/wprobe-lib.c b/package/wprobe/src/user/wprobe-lib.c index a1a52f205..7a5460bb0 100644 --- a/package/wprobe/src/user/wprobe-lib.c +++ b/package/wprobe/src/user/wprobe-lib.c @@ -13,6 +13,8 @@ * GNU General Public License for more details. */ +#define _ISOC99_SOURCE +#define _BSD_SOURCE #include #include #include @@ -558,7 +560,9 @@ wprobe_msg_to_network(int socket, struct nl_msg *msg) 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; @@ -570,6 +574,8 @@ wprobe_msg_to_network(int socket, struct nl_msg *msg) swap_genlmsghdr(gnlh); swap_nlmsghdr(nlh); ret = write(socket, buf, buflen); + +out: free(buf); return ret;