Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-06-30 21:00:10 +0400
committerCorinna Vinschen <corinna@vinschen.de>2005-06-30 21:00:10 +0400
commitf2abf3173b6993f20f3133372600a17dff607298 (patch)
tree8dbe66b4ca7b62b504ef1cc902f015071ddefa55 /winsup/cygwin/fhandler.cc
parent5b3e1f7358338fa4fe7223fb34df9a06fda7e97c (diff)
* fhandler.cc (fhandler_base::readv): Use malloc/free instead of alloca.
(fhandler_base::writev): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 2f034007a..e5e08b0b9 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -970,7 +970,7 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
if (!len)
return 0;
- char *buf = (char *) alloca (tot);
+ char *buf = (char *) malloc (tot);
if (!buf)
{
@@ -992,6 +992,7 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
nbytes -= frag;
}
+ free (buf);
return len;
}
@@ -1022,7 +1023,7 @@ fhandler_base::writev (const struct iovec *const iov, const int iovcnt,
if (tot == 0)
return 0;
- char *const buf = (char *) alloca (tot);
+ char *const buf = (char *) malloc (tot);
if (!buf)
{
@@ -1042,8 +1043,9 @@ fhandler_base::writev (const struct iovec *const iov, const int iovcnt,
iovptr += 1;
nbytes -= frag;
}
-
- return write (buf, tot);
+ ssize_t ret = write (buf, tot);
+ free (buf);
+ return ret;
}
_off64_t