summaryrefslogtreecommitdiff
path: root/ghc/lib/std/cbits/writeFile.c
diff options
context:
space:
mode:
authorsof <unknown>1999-09-12 19:18:22 +0000
committersof <unknown>1999-09-12 19:18:22 +0000
commit59c0fcd8b4311a486417dad3e371aab96dc41489 (patch)
tree21528d37fe705dcf1fc7864ce4f7917369787a05 /ghc/lib/std/cbits/writeFile.c
parent2abf19114db9a6e20db2138112d2e03c28485788 (diff)
downloadhaskell-59c0fcd8b4311a486417dad3e371aab96dc41489.tar.gz
[project @ 1999-09-12 19:18:22 by sof]
In case of a partial writes, buffer pointer wasn't being adjusted/used.
Diffstat (limited to 'ghc/lib/std/cbits/writeFile.c')
-rw-r--r--ghc/lib/std/cbits/writeFile.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/ghc/lib/std/cbits/writeFile.c b/ghc/lib/std/cbits/writeFile.c
index 71e5a23d26..e69442d994 100644
--- a/ghc/lib/std/cbits/writeFile.c
+++ b/ghc/lib/std/cbits/writeFile.c
@@ -1,7 +1,7 @@
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
- * $Id: writeFile.c,v 1.6 1999/07/12 10:43:13 sof Exp $
+ * $Id: writeFile.c,v 1.7 1999/09/12 19:18:22 sof Exp $
*
* hPutStr Runtime Support
*/
@@ -47,7 +47,7 @@ StgInt bytes;
int count, rc=0;
IOFileObject* fo = (IOFileObject*)ptr;
- char *p = (char *) fo->buf;
+ char *pBuf = (char *) fo->buf;
/* Disallow short writes */
if (bytes == 0 || fo->buf == NULL)
@@ -60,10 +60,10 @@ StgInt bytes;
(
#ifdef USE_WINSOCK
fo->flags & FILEOBJ_WINSOCK ?
- send(fo->fd, fo->buf, bytes, 0) :
- write(fo->fd, fo->buf, bytes))) < bytes) {
+ send(fo->fd, pBuf, bytes, 0) :
+ write(fo->fd, pBuf, bytes))) < bytes) {
#else
- write(fo->fd, fo->buf, bytes))) < bytes) {
+ write(fo->fd, pBuf, bytes))) < bytes) {
#endif
if (errno != EINTR) {
cvtErrno();
@@ -71,7 +71,7 @@ StgInt bytes;
return -1;
}
bytes -= count;
- p += count;
+ pBuf += count;
}
/* Signal that we've emptied the buffer */
fo->bufWPtr=0;
@@ -88,7 +88,7 @@ StgInt len;
IOFileObject* fo = (IOFileObject*)ptr;
int count;
int rc = 0;
- char *p = (char *) buf;
+ char *pBuf = (char *) buf;
if (len == 0 )
return 0;
@@ -129,18 +129,18 @@ StgInt len;
(
#ifdef USE_WINSOCK
fo->flags & FILEOBJ_WINSOCK ?
- send(fo->fd, (char*)buf, (int)len, 0) :
- write(fo->fd, (char*)buf, (int)len))) < len ) {
+ send(fo->fd, pBuf, (int)len, 0) :
+ write(fo->fd, pBuf, (int)len))) < len ) {
#else
- write(fo->fd, (char*)buf, (int)len))) < len ) {
+ write(fo->fd, pBuf, (int)len))) < len ) {
#endif
if (errno != EINTR) {
cvtErrno();
stdErrno();
return -1;
}
- len -= count;
- p += count;
+ len -= count;
+ pBuf += count;
}
return 0;