]> granicus.if.org Git - shadow/commitdiff
* lib/commonio.c: len should be typed ssize_t as it is the return
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 13 Jun 2008 21:53:41 +0000 (21:53 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 13 Jun 2008 21:53:41 +0000 (21:53 +0000)
of read(), and is compared to 0. Cast to size_t when necessary.

ChangeLog
lib/commonio.c

index d43d45adb10e11c01f01cd822e3f390b7257cc8e..16d607d4e7f21f7db59eb1e0d8298c3040479eca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-13  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * lib/commonio.c: len should be typed ssize_t as it is the return
+       of read(), and is compared to 0. Cast to size_t when necessary.
+
 2008-06-13  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/find_new_ids.c: Use getdef_ulong to retrieve UIDs/GIDs
index ae9073c07f0003b8016239e9fa769628b47914ea..5451da0fba9c5e7ebd369d86ed58e381d08df54a 100644 (file)
@@ -113,7 +113,7 @@ static int do_lock_file (const char *file, const char *lock)
 {
        int fd;
        pid_t pid;
-       size_t len;
+       ssize_t len;
        int retval;
        char buf[32];
 
@@ -124,8 +124,8 @@ static int do_lock_file (const char *file, const char *lock)
 
        pid = getpid ();
        snprintf (buf, sizeof buf, "%lu", (unsigned long) pid);
-       len = strlen (buf) + 1;
-       if (write (fd, buf, len) != (ssize_t) len) {
+       len = (ssize_t) strlen (buf) + 1;
+       if (write (fd, buf, (size_t) len) != len) {
                (void) close (fd);
                unlink (file);
                return 0;