From 6b70e99430a0b154245691cb9ff773ee760178da Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 15 Jun 2009 12:05:31 +0000 Subject: * 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 --- daemon/utmpd/utmpsync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'daemon/utmpd') 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; -- cgit v1.2.3