Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/shlock Fix casts which are inconsistent with *printf...



details:   https://anonhg.NetBSD.org/src/rev/6d4d7a597144
branches:  trunk
changeset: 337294:6d4d7a597144
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Apr 10 09:34:43 2015 +0000

description:
Fix casts which are inconsistent with *printf() formats and remove the
use of a non-standard type in the process.

diffstat:

 usr.bin/shlock/shlock.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r 9ca4b947ce29 -r 6d4d7a597144 usr.bin/shlock/shlock.c
--- a/usr.bin/shlock/shlock.c   Fri Apr 10 08:43:32 2015 +0000
+++ b/usr.bin/shlock/shlock.c   Fri Apr 10 09:34:43 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: shlock.c,v 1.12 2011/09/06 18:30:38 joerg Exp $        */
+/*     $NetBSD: shlock.c,v 1.13 2015/04/10 09:34:43 tron Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: shlock.c,v 1.12 2011/09/06 18:30:38 joerg Exp $");
+__RCSID("$NetBSD: shlock.c,v 1.13 2015/04/10 09:34:43 tron Exp $");
 #endif
 
 #include <sys/types.h>
@@ -123,7 +123,7 @@
        char    *cp, buf[BUFSIZ];
        static char     tempname[BUFSIZ];
 
-       sprintf(buf, "shlock%ld", (u_long)getpid());
+       sprintf(buf, "shlock%ld", (long)getpid());
        if ((cp = strrchr(strcpy(tempname, file), '/')) != NULL) {
                *++cp = '\0';
                (void) strcat(tempname, buf);
@@ -131,7 +131,7 @@
                (void) strcpy(tempname, buf);
        dprintf("%s: temporary filename: %s\n", Pname, tempname);
 
-       sprintf(buf, "%ld\n", (u_long)pid);
+       sprintf(buf, "%ld\n", (long)pid);
        len = strlen(buf);
 openloop:
        if ((fd = open(tempname, O_RDWR|O_CREAT|O_EXCL, 0644)) < 0) {
@@ -165,7 +165,7 @@
                (write(fd, buf, len) < 0))
        {
                fprintf(stderr, "%s: write(%s,%ld): %s\n",
-                       Pname, tempname, (u_long)pid, strerror(errno));
+                       Pname, tempname, (long)pid, strerror(errno));
                (void) close(fd);
                if (unlink(tempname) < 0) {
                        fprintf(stderr, E_unlk,
@@ -184,7 +184,7 @@
 static int
 p_exists(pid_t pid)
 {
-       dprintf("%s: process %ld is ", Pname, (u_long)pid);
+       dprintf("%s: process %ld is ", Pname, (long)pid);
        if (pid <= 0) {
                dprintf("invalid\n");
                return(FALSE);
@@ -256,7 +256,7 @@
        int     retcode = FALSE;
 
        dprintf("%s: trying lock <%s> for process %ld\n", Pname, file,
-           (u_long)pid);
+           (long)pid);
        if ((tmp = xtmpfile(file, pid, uucpstyle)) == NULL)
                return(FALSE);
 



Home | Main Index | Thread Index | Old Index