From fe71812b1df6b49d26046f44f125c25a56a91c2a Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Wed, 17 Mar 2010 23:59:47 +0000 Subject: [PATCH] * lib/commonio.c: Avoid implicit conversion of pointers to booleans. * lib/commonio.c: Ignore the return value of close when a failure is reported. --- ChangeLog | 9 ++++++++- lib/commonio.c | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8ca2904..8831df21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-03-17 Nicolas François + + * lib/commonio.c: Avoid implicit conversion of pointers to + booleans. + * lib/commonio.c: Ignore the return value of close when a + failure is reported. + 2010-03-16 Nicolas François * man/faillog.8.xml: Document the behavior in display mode of the @@ -878,7 +885,7 @@ 2009-04-30 Nicolas François - * lib/commonio.c: Ignore teh return values of fclose() and + * lib/commonio.c: Ignore the return values of fclose() and unlink() in case of failure of fopen_set_perms() or create_backup(). * lib/commonio.c: Should the backup file be unlink'ed in case of diff --git a/lib/commonio.c b/lib/commonio.c index 03b001e0..fa37704c 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -572,8 +572,8 @@ int commonio_open (struct commonio_db *db, int mode) #endif /* WITH_TCB */ db->fp = fdopen (fd, db->readonly ? "r" : "r+"); saved_errno = errno; - if (!db->fp) { - close (fd); + if (NULL == db->fp) { + (void) close (fd); } } errno = saved_errno;