summaryrefslogtreecommitdiffstats
path: root/daemon/utmpd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-15 20:05:31 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-15 20:05:31 +0800
commit6b70e99430a0b154245691cb9ff773ee760178da (patch)
tree13ad2a8d4e58166a3c3eb0ae8e8da372ca229845 /daemon/utmpd
parent4acd952f48f8d0ac2da8d590dd8a7494cca0384c (diff)
downloadpttbbs-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 'daemon/utmpd')
-rw-r--r--daemon/utmpd/utmpsync.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/daemon/utmpd/utmpsync.c b/daemon/utmpd/utmpsync.c
index 53f61ac0..8e74190d 100644
--- a/daemon/utmpd/utmpsync.c
+++ b/daemon/utmpd/utmpsync.c
@@ -16,11 +16,11 @@ int main(int argc, char **argv)
index = -1;
towrite(sfd, &index, sizeof(index));
for( i = 0 ; i < USHM_SIZE ; ++i )
- if( towrite(sfd, &SHM->uinfo[i].uid, sizeof(SHM->uinfo[i].uid)) < 0 ||
+ if( towrite(sfd, &SHM->uinfo[i].uid, sizeof(SHM->uinfo[i].uid)) <= 0 ||
towrite(sfd, SHM->uinfo[i].myfriend,
- sizeof(SHM->uinfo[i].myfriend)) < 0 ||
+ sizeof(SHM->uinfo[i].myfriend)) <= 0 ||
towrite(sfd, SHM->uinfo[i].reject,
- sizeof(SHM->uinfo[i].reject)) < 0 ){
+ sizeof(SHM->uinfo[i].reject)) <= 0 ){
fprintf(stderr, "sync error %d\n", i);
}
return 0;