From 5d58b43ccc36e1e4b452751a9a05b9caded186bd Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 26 May 2002 09:32:45 +0000 Subject: pid_t cleanup --- libexec/ftpd/ftpd.c | 6 +++--- libexec/ftpd/popen.c | 7 ++++--- libexec/login_chpass/login_chpass.c | 6 +++--- libexec/rshd/rshd.c | 8 ++++---- libexec/uucpd/uucpd.c | 17 +++++++++-------- usr.sbin/wsmoused/wsmoused.c | 4 ++-- usr.sbin/ypserv/ypserv/ypserv.c | 8 ++++---- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 4e3a465c948..d8624462bdf 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.125 2002/03/30 22:01:51 deraadt Exp $ */ +/* $OpenBSD: ftpd.c,v 1.126 2002/05/26 09:32:07 deraadt Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -73,7 +73,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #else -static char rcsid[] = "$OpenBSD: ftpd.c,v 1.125 2002/03/30 22:01:51 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ftpd.c,v 1.126 2002/05/26 09:32:07 deraadt Exp $"; #endif #endif /* not lint */ @@ -474,7 +474,7 @@ main(argc, argv, envp) } /* set this here so klogin can use it... */ - (void)snprintf(ttyline, sizeof(ttyline), "ftp%d", getpid()); + (void)snprintf(ttyline, sizeof(ttyline), "ftp%ld", (long)getpid()); sa.sa_handler = SIG_DFL; (void) sigaction(SIGCHLD, &sa, NULL); diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c index acf15a6f934..4e83ddf02e1 100644 --- a/libexec/ftpd/popen.c +++ b/libexec/ftpd/popen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popen.c,v 1.14 2002/01/23 16:31:18 mpech Exp $ */ +/* $OpenBSD: popen.c,v 1.15 2002/05/26 09:32:07 deraadt Exp $ */ /* $NetBSD: popen.c,v 1.5 1995/04/11 02:45:00 cgd Exp $ */ /* @@ -78,7 +78,8 @@ ftpd_popen(program, type) { char *cp; FILE *iop; - int argc, gargc, pdes[2], pid; + int argc, gargc, pdes[2]; + pid_t pid; char **pop, *argv[MAX_ARGV], *gargv[MAX_GARGV]; if ((*type != 'r' && *type != 'w') || type[1]) @@ -127,7 +128,7 @@ ftpd_popen(program, type) iop = NULL; - switch(pid = fork()) { + switch (pid = fork()) { case -1: /* error */ (void)close(pdes[0]); (void)close(pdes[1]); diff --git a/libexec/login_chpass/login_chpass.c b/libexec/login_chpass/login_chpass.c index c05d9e036e8..f862dce98f1 100644 --- a/libexec/login_chpass/login_chpass.c +++ b/libexec/login_chpass/login_chpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_chpass.c,v 1.6 2002/02/16 21:27:30 millert Exp $ */ +/* $OpenBSD: login_chpass.c,v 1.7 2002/05/26 09:32:08 deraadt Exp $ */ /*- * Copyright (c) 1995,1996 Berkeley Software Design, Inc. All rights reserved. @@ -309,8 +309,8 @@ krb_chpass(username, instance, argv) krb_get_default_principal(principal.name, principal.instance, principal.realm); - snprintf(tktstring, sizeof(tktstring), "%s.chpass.%s.%d", - TKT_ROOT, username, getpid()); + snprintf(tktstring, sizeof(tktstring), "%s.chpass.%s.%ld", + TKT_ROOT, username, (long)getpid()); krb_set_tkt_string(tktstring); (void)setpriority(PRIO_PROCESS, 0, -4); diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index 7ce3816c50c..dc138e05f6a 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rshd.c,v 1.45 2002/05/22 06:35:44 deraadt Exp $ */ +/* $OpenBSD: rshd.c,v 1.46 2002/05/26 09:32:08 deraadt Exp $ */ /*- * Copyright (c) 1988, 1989, 1992, 1993, 1994 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; */ -static char *rcsid = "$OpenBSD: rshd.c,v 1.45 2002/05/22 06:35:44 deraadt Exp $"; +static char *rcsid = "$OpenBSD: rshd.c,v 1.46 2002/05/26 09:32:08 deraadt Exp $"; #endif /* not lint */ /* @@ -215,8 +215,8 @@ doit(fromp) u_short port; in_port_t *portp; fd_set ready, readfrom; - int cc, nfd, pv[2], pid, s = 0; - int one = 1; + int cc, nfd, pv[2], s = 0, one = 1; + pid_t pid; char *hostname, *errorstr, *errorhost = (char *) NULL; char *cp, sig, buf[BUFSIZ]; char cmdbuf[NCARGS+1], locuser[_PW_NAME_LEN+1], remuser[_PW_NAME_LEN+1]; diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c index abbe2cac44d..f4187effc7a 100644 --- a/libexec/uucpd/uucpd.c +++ b/libexec/uucpd/uucpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uucpd.c,v 1.22 2002/05/22 06:35:44 deraadt Exp $ */ +/* $OpenBSD: uucpd.c,v 1.23 2002/05/26 09:32:08 deraadt Exp $ */ /* * Copyright (c) 1985 The Regents of the University of California. @@ -44,7 +44,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)uucpd.c 5.10 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$OpenBSD: uucpd.c,v 1.22 2002/05/22 06:35:44 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: uucpd.c,v 1.23 2002/05/26 09:32:08 deraadt Exp $"; #endif /* not lint */ /* @@ -79,9 +79,9 @@ void dologout(void); void dologin(struct passwd *, struct sockaddr_in *); struct sockaddr_in hisctladdr; -int hisaddrlen = sizeof hisctladdr; +int hisaddrlen = sizeof hisctladdr; struct sockaddr_in myctladdr; -int mypid; +pid_t mypid; char Username[64], Loginname[64]; char *nenv[] = { @@ -117,7 +117,7 @@ char **argv; } if ((childpid = fork()) == 0) doit(&hisctladdr); - snprintf(utline, sizeof(utline), "uucp%.4d", childpid); + snprintf(utline, sizeof(utline), "uucp%.4ld", (long)childpid); dologout(); exit(1); #else /* !BSDINETD */ @@ -128,7 +128,7 @@ char **argv; } if (fork()) exit(0); - snprintf(utline, sizeof(utline), "uucp%.4d", childpid); + snprintf(utline, sizeof(utline), "uucp%.4ld", (long)childpid); if ((s=open(_PATH_TTY, 2)) >= 0){ ioctl(s, TIOCNOTTY, (char *)0); @@ -260,7 +260,8 @@ void dologout() { int save_errno = errno; - int status, pid, wtmp; + int status, wtmp; + pid_t pid; #ifdef BSDINETD while ((pid=wait(&status)) > 0) { @@ -306,7 +307,7 @@ struct sockaddr_in *sin; wtmp = open(_PATH_WTMP, O_WRONLY|O_APPEND); if (wtmp >= 0) { /* hack, but must be unique and no tty line */ - (void) snprintf(line, sizeof line, "uucp%.4d", getpid()); + (void) snprintf(line, sizeof line, "uucp%.4ld", (long)getpid()); SCPYN(utmp.ut_line, line); SCPYN(utmp.ut_name, pw->pw_name); SCPYN(utmp.ut_host, remotehost); diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c index b20ef981b3b..db252ea5639 100644 --- a/usr.sbin/wsmoused/wsmoused.c +++ b/usr.sbin/wsmoused/wsmoused.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmoused.c,v 1.11 2002/03/27 18:54:09 jbm Exp $ */ +/* $OpenBSD: wsmoused.c,v 1.12 2002/05/26 09:32:44 deraadt Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -398,7 +398,7 @@ wsmoused(void) background = TRUE; fp = fopen(pidfile, "w"); if (fp != NULL) { - fprintf(fp, "%d\n", getpid()); + fprintf(fp, "%ld\n", (long)getpid()); fclose(fp); } } diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c index cc283d4d5fe..e0073649dca 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.c +++ b/usr.sbin/ypserv/ypserv/ypserv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv.c,v 1.21 2002/02/19 19:39:41 millert Exp $ */ +/* $OpenBSD: ypserv.c,v 1.22 2002/05/26 09:32:44 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypserv.c,v 1.21 2002/02/19 19:39:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: ypserv.c,v 1.22 2002/05/26 09:32:44 deraadt Exp $"; #endif #include @@ -454,8 +454,8 @@ main(argc, argv) openlog("ypserv", LOG_PID, LOG_DAEMON); } else { #ifndef RPC_SVC_FG - int size; - int pid, i; + int size, i; + pid_t pid; pid = fork(); if (pid < 0) { -- cgit v1.2.3