projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 1999-09-16 13:14:38 by simonmar]
[ghc-hetmet.git]
/
ghc
/
lib
/
std
/
cbits
/
filePutc.c
diff --git
a/ghc/lib/std/cbits/filePutc.c
b/ghc/lib/std/cbits/filePutc.c
index
d613779
..
b48f9fe
100644
(file)
--- a/
ghc/lib/std/cbits/filePutc.c
+++ b/
ghc/lib/std/cbits/filePutc.c
@@
-1,7
+1,7
@@
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
- * $Id: filePutc.c,v 1.6 1999/07/03 18:45:04 sof Exp $
+ * $Id: filePutc.c,v 1.8 1999/09/16 13:14:43 simonmar Exp $
*
* hPutChar Runtime Support
*/
*
* hPutChar Runtime Support
*/
@@
-10,7
+10,7
@@
#include "stgio.h"
#include "error.h"
#include "stgio.h"
#include "error.h"
-#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
+#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
#define USE_WINSOCK
#endif
#define USE_WINSOCK
#endif
@@
-78,23
+78,25
@@
StgChar c;
return rc;
}
return rc;
}
- if ( fo->flags & FILEOBJ_NONBLOCKING_IO )
- return FILEOBJ_BLOCKED_WRITE;
-
/* Unbuffered, write the character directly. */
/* Unbuffered, write the character directly. */
- while ((rc = (
+ while (rc = (
#ifdef USE_WINSOCK
fo->flags & FILEOBJ_WINSOCK ?
send(fo->fd, &c, 1, 0) :
#ifdef USE_WINSOCK
fo->flags & FILEOBJ_WINSOCK ?
send(fo->fd, &c, 1, 0) :
- write(fo->fd, &c, 1))) == 0 && errno == EINTR) ;
+ write(fo->fd, &c, 1)) <= 0) {
#else
#else
- write(fo->fd, &c, 1))) == 0 && errno == EINTR) ;
+ write(fo->fd, &c, 1)) <= 0) {
#endif
#endif
- if (rc == 0) {
- cvtErrno();
- stdErrno();
- return -1;
+
+ if ( rc == -1 && errno == EAGAIN) {
+ errno = 0;
+ return FILEOBJ_BLOCKED_WRITE;
+ } else if (rc == 0 || rc == -1 && errno != EINTR) {
+ cvtErrno();
+ stdErrno();
+ return -1;
+ }
}
}
- return 0;
+ return 0;
}
}