[Pkg-shadow-commits] r2140 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Fri Jun 13 19:50:50 UTC 2008
Author: nekral-guest
Date: 2008-06-13 19:50:49 +0000 (Fri, 13 Jun 2008)
New Revision: 2140
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/log.c
Log:
* libmisc/log.c: Avoid assignments in comparisons.
* libmisc/log.c: Add brackets and parenthesis.
* libmisc/log.c: read() returns a ssize_t (note size_t).
* libmisc/log.c: Avoid implicit conversion of pointers to
booleans.
* libmisc/log.c: Ignore return value of time() when use with a
non NULL argument.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-06-13 19:48:11 UTC (rev 2139)
+++ upstream/trunk/ChangeLog 2008-06-13 19:50:49 UTC (rev 2140)
@@ -1,5 +1,15 @@
2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
+ * libmisc/log.c: Avoid assignments in comparisons.
+ * libmisc/log.c: Add brackets and parenthesis.
+ * libmisc/log.c: read() returns a ssize_t (note size_t).
+ * libmisc/log.c: Avoid implicit conversion of pointers to
+ booleans.
+ * libmisc/log.c: Ignore return value of time() when use with a
+ non NULL argument.
+
+2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/strtoday.c: Avoid implicit conversion of pointers to
booleans.
* libmisc/strtoday.c: Add brackets and parenthesis.
Modified: upstream/trunk/libmisc/log.c
===================================================================
--- upstream/trunk/libmisc/log.c 2008-06-13 19:48:11 UTC (rev 2139)
+++ upstream/trunk/libmisc/log.c 2008-06-13 19:50:49 UTC (rev 2140)
@@ -62,8 +62,10 @@
* If the file does not exist, don't create it.
*/
- if ((fd = open (LASTLOG_FILE, O_RDWR)) == -1)
+ fd = open (LASTLOG_FILE, O_RDWR);
+ if (-1 == fd) {
return;
+ }
/*
* The file is indexed by UID number. Seek to the record
@@ -83,19 +85,23 @@
* the way we read the old one in.
*/
- if (read (fd, (char *) &newlog, sizeof newlog) != sizeof newlog)
+ if (read (fd, (char *) &newlog, sizeof newlog) != (ssize_t) sizeof newlog) {
memzero (&newlog, sizeof newlog);
- if (ll)
+ }
+ if (NULL != ll) {
*ll = newlog;
+ }
ll_time = newlog.ll_time;
- time (&ll_time);
+ (void) time (&ll_time);
newlog.ll_time = ll_time;
strncpy (newlog.ll_line, line, sizeof newlog.ll_line);
#if HAVE_LL_HOST
strncpy (newlog.ll_host, host, sizeof newlog.ll_host);
#endif
- if (lseek (fd, offset, SEEK_SET) == offset)
+ if (lseek (fd, offset, SEEK_SET) == offset) {
write (fd, (char *) &newlog, sizeof newlog);
+ }
close (fd);
}
+
More information about the Pkg-shadow-commits
mailing list