(sendmsg): error check malloc properly

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6404 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-07-03 02:37:15 +00:00
parent 5656cb2244
commit 4e6f8b54ac

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -55,7 +55,7 @@ sendmsg(int s, const struct msghdr *msg, int flags)
for(i = 0; i < msg->msg_iovlen; ++i)
tot += iov[i].iov_len;
buf = malloc(tot);
if (buf == NULL) {
if (tot != 0 && buf == NULL) {
errno = ENOMEM;
return -1;
}