diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-15 20:05:31 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-15 20:05:31 +0800 |
commit | 6b70e99430a0b154245691cb9ff773ee760178da (patch) | |
tree | 13ad2a8d4e58166a3c3eb0ae8e8da372ca229845 /common/sys | |
parent | 4acd952f48f8d0ac2da8d590dd8a7494cca0384c (diff) | |
download | pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.tar pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.tar.gz pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.tar.bz2 pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.tar.lz pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.tar.xz pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.tar.zst pttbbs-6b70e99430a0b154245691cb9ff773ee760178da.zip |
* change toread/towrite's return value to be '-1 for EOF and error'.
* make the callers of toread/towrite more robust
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4621 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/sys')
-rw-r--r-- | common/sys/net.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/sys/net.c b/common/sys/net.c index 5bf9dc5e..cf6ca658 100644 --- a/common/sys/net.c +++ b/common/sys/net.c @@ -191,7 +191,8 @@ int toread(int fd, void *buf, int len) if( (l = read(fd, buf, len)) <= 0 ) { if (l < 0 && (errno == EINTR || errno == EAGAIN)) continue; - return l; + // XXX we define toread/towrite as '-1 for EOF and error'. + return -1; // l; }else{ buf += l; len -= l; @@ -209,7 +210,8 @@ int towrite(int fd, const void *buf, int len) if( (l = write(fd, buf, len)) <= 0){ if (l < 0 && (errno == EINTR || errno == EAGAIN)) continue; - return l; + // XXX we define toread/towrite as '-1 for EOF and error'. + return -1; // l; }else{ buf += l; len -= l; |