]> git.pond.sub.org Git - empserver/commitdiff
(readv, writev) [_WIN32]: Set errno to ENOMEM when
authorRon Koenderink <rkoenderink@yahoo.ca>
Sat, 8 Dec 2007 23:00:37 +0000 (23:00 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sat, 8 Dec 2007 23:00:37 +0000 (23:00 +0000)
unable memory.

src/lib/w32/posixio.c

index e6fe7f30dfc9eda5385f9d892b36841be0050611..8a5f4b7b7f9b0e061eba91f3edf1725608fdd346 100644 (file)
@@ -520,8 +520,10 @@ readv(int fd, const struct iovec *iov, int iovcnt)
     }
 
     buffer = malloc(total_bytes);
-    if (buffer == NULL && total_bytes != 0)
+    if (buffer == NULL && total_bytes != 0) {
+       errno = ENOMEM;
        return -1;
+    }
 
     bytes_read = posix_read(fd, buffer, total_bytes);
     if (bytes_read <= 0) {
@@ -573,8 +575,10 @@ writev(int fd, const struct iovec *iov, int iovcnt)
        total_bytes += iov[i].iov_len;
 
     buffer = malloc(total_bytes);
-    if (buffer == NULL && total_bytes != 0)
+    if (buffer == NULL && total_bytes != 0) {
+       errno = ENOMEM;
        return -1;
+    }
 
     buffer_location = buffer;
     for (i = 0; i < iovcnt; i++) {