summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-26 09:25:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-26 09:25:23 +0000
commit6aa6edb00aa211e3677bbe83a79f77a698463a78 (patch)
tree0d78960a0fcda70c8880a741fb843e94c28a0bb5
parentc300dc80ea9a11b57eb166b83bf23af534af067f (diff)
pid_t cleanup
-rw-r--r--sbin/fsck/preen.c7
-rw-r--r--sbin/fsck_ext2fs/preen.c9
-rw-r--r--sbin/isakmpd/isakmpd.c4
-rw-r--r--sbin/isakmpd/pf_key_v2.c6
-rw-r--r--sbin/mount_portal/mount_portal.c6
-rw-r--r--sbin/mountd/mountd.c4
-rw-r--r--sbin/newfs/newfs.c6
-rw-r--r--sbin/route/route.c8
-rw-r--r--sbin/routed/table.c4
-rw-r--r--sbin/shutdown/shutdown.c8
-rw-r--r--sbin/slattach/slattach.c6
-rw-r--r--usr.sbin/arp/arp.c6
-rw-r--r--usr.sbin/edquota/edquota.c5
-rw-r--r--usr.sbin/inetd/inetd.c17
-rw-r--r--usr.sbin/mopd/mopd/mopd.c7
-rw-r--r--usr.sbin/pppd/ipxcp.c6
-rw-r--r--usr.sbin/pppd/magic.c10
-rw-r--r--usr.sbin/pppd/main.c19
-rw-r--r--usr.sbin/pppd/sys-bsd.c17
-rw-r--r--usr.sbin/rarpd/arptab.c2
-rw-r--r--usr.sbin/rarpd/rarpd.c7
-rw-r--r--usr.sbin/rpc.pcnfsd/pcnfsd_misc.c13
-rw-r--r--usr.sbin/screenblank/screenblank.c4
-rw-r--r--usr.sbin/syslogd/syslogd.c6
24 files changed, 102 insertions, 85 deletions
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
index 746e85c614f..f832e330c77 100644
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: preen.c,v 1.9 2002/03/14 06:51:41 mpech Exp $ */
+/* $OpenBSD: preen.c,v 1.10 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: preen.c,v 1.15 1996/09/28 19:21:42 christos Exp $ */
/*
@@ -94,9 +94,10 @@ checkfstab(flags, maxrun, docheck, checkit)
struct fstab *fs;
struct diskentry *d, *nextdisk;
struct partentry *p;
- int ret, pid, retcode, passno, sumstatus, status;
+ int ret, retcode, passno, sumstatus, status;
void *auxarg;
char *name;
+ pid_t pid;
TAILQ_INIT(&badh);
TAILQ_INIT(&diskh);
@@ -165,7 +166,7 @@ checkfstab(flags, maxrun, docheck, checkit)
break;
if (d == NULL) {
- warnx("Unknown pid %d", pid);
+ warnx("Unknown pid %ld", (long)pid);
continue;
}
diff --git a/sbin/fsck_ext2fs/preen.c b/sbin/fsck_ext2fs/preen.c
index a235d4205e7..408342c268d 100644
--- a/sbin/fsck_ext2fs/preen.c
+++ b/sbin/fsck_ext2fs/preen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: preen.c,v 1.6 2002/02/17 19:42:27 millert Exp $ */
+/* $OpenBSD: preen.c,v 1.7 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: preen.c,v 1.2 1997/09/14 14:27:30 lukem Exp $ */
/*
@@ -56,7 +56,7 @@ struct disk {
char *name; /* disk base name */
struct disk *next; /* forward link for list of disks */
struct part *part; /* head of list of partitions on disk */
- int pid; /* If != 0, pid of proc working on */
+ pid_t pid; /* If != 0, pid of proc working on */
} *disks;
int nrun, ndisks;
@@ -74,9 +74,10 @@ checkfstab(preen, maxrun, docheck, chkit)
struct fstab *fsp;
struct disk *dk, *nextdisk;
struct part *pt;
- int ret, pid, retcode, passno, sumstatus, status;
+ int ret, retcode, passno, sumstatus, status;
long auxdata;
char *name;
+ pid_t pid;
sumstatus = 0;
for (passno = 1; passno <= 2; passno++) {
@@ -126,7 +127,7 @@ checkfstab(preen, maxrun, docheck, chkit)
if (dk->pid == pid)
break;
if (dk == 0) {
- printf("Unknown pid %d\n", pid);
+ printf("Unknown pid %ld\n", (long)pid);
continue;
}
if (WIFEXITED(status))
diff --git a/sbin/isakmpd/isakmpd.c b/sbin/isakmpd/isakmpd.c
index add4ba90767..13c26121018 100644
--- a/sbin/isakmpd/isakmpd.c
+++ b/sbin/isakmpd/isakmpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isakmpd.c,v 1.39 2001/12/11 01:54:34 ho Exp $ */
+/* $OpenBSD: isakmpd.c,v 1.40 2002/05/26 09:24:35 deraadt Exp $ */
/* $EOM: isakmpd.c,v 1.54 2000/10/05 09:28:22 niklas Exp $ */
/*
@@ -333,7 +333,7 @@ write_pid_file (void)
if (fp != NULL)
{
/* XXX Error checking! */
- fprintf (fp, "%d\n", getpid ());
+ fprintf (fp, "%ld\n", (long) getpid ());
fclose (fp);
}
else
diff --git a/sbin/isakmpd/pf_key_v2.c b/sbin/isakmpd/pf_key_v2.c
index c20ef22b4af..d2fe21a1fd2 100644
--- a/sbin/isakmpd/pf_key_v2.c
+++ b/sbin/isakmpd/pf_key_v2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_key_v2.c,v 1.97 2002/02/21 20:12:56 angelos Exp $ */
+/* $OpenBSD: pf_key_v2.c,v 1.98 2002/05/26 09:24:35 deraadt Exp $ */
/* $EOM: pf_key_v2.c,v 1.79 2000/12/12 00:33:19 niklas Exp $ */
/*
@@ -379,8 +379,8 @@ pf_key_v2_read (u_int32_t seq)
{
LOG_DBG ((LOG_SYSDEP, 90,
"pf_key_v2_read:"
- "bad version (%d) or PID (%d, mine is %d), ignored",
- msg->sadb_msg_version, msg->sadb_msg_pid,
+ "bad version (%d) or PID (%ld, mine is %d), ignored",
+ msg->sadb_msg_version, (long)msg->sadb_msg_pid,
getpid ()));
goto cleanup;
}
diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c
index ab7511eceef..38dd40697cd 100644
--- a/sbin/mount_portal/mount_portal.c
+++ b/sbin/mount_portal/mount_portal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_portal.c,v 1.19 2002/05/22 08:21:02 deraadt Exp $ */
+/* $OpenBSD: mount_portal.c,v 1.20 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: mount_portal.c,v 1.8 1996/04/13 01:31:54 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
#else
-static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.19 2002/05/22 08:21:02 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.20 2002/05/26 09:24:35 deraadt Exp $";
#endif
#endif /* not lint */
@@ -194,7 +194,7 @@ main(argc, argv)
*/
daemon(0, 0);
- (void)snprintf(tag, sizeof(tag), "portal:%d", getpid());
+ (void)snprintf(tag, sizeof(tag), "portal:%ld", (long)getpid());
args.pa_config = tag;
/*
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 42a4ef92177..e4a420f5c72 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.45 2002/04/23 18:54:12 espie Exp $ */
+/* $OpenBSD: mountd.c,v 1.46 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -285,7 +285,7 @@ main(argc, argv)
} else {
pidfile = fopen(_PATH_MOUNTDPID, "w");
}
- fprintf(pidfile, "%d\n", getpid());
+ fprintf(pidfile, "%ld\n", (long)getpid());
fclose(pidfile);
signal(SIGHUP, (void (*)(int)) new_exportlist);
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 3ccea89e879..db1ceb4403d 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.34 2002/05/06 19:25:06 millert Exp $ */
+/* $OpenBSD: newfs.c,v 1.35 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: newfs.c,v 1.34 2002/05/06 19:25:06 millert Exp $";
+static char rcsid[] = "$OpenBSD: newfs.c,v 1.35 2002/05/26 09:24:35 deraadt Exp $";
#endif
#endif /* not lint */
@@ -589,7 +589,7 @@ havelabel:
if (mfs) {
struct mfs_args args;
- sprintf(buf, "mfs:%d", getpid());
+ sprintf(buf, "mfs:%ld", (long)getpid());
args.fspec = buf;
args.export_info.ex_root = -2;
if (mntflags & MNT_RDONLY)
diff --git a/sbin/route/route.c b/sbin/route/route.c
index b1df9d868b8..6750a6e2264 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.45 2002/05/20 23:06:27 itojun Exp $ */
+/* $OpenBSD: route.c,v 1.46 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: route.c,v 1.45 2002/05/20 23:06:27 itojun Exp $";
+static char rcsid[] = "$OpenBSD: route.c,v 1.46 2002/05/26 09:24:35 deraadt Exp $";
#endif
#endif /* not lint */
@@ -1492,8 +1492,8 @@ print_rtmsg(rtm, msglen)
pmsg_addrs((char *)(ifam + 1), ifam->ifam_addrs);
break;
default:
- (void) printf("pid: %d, seq %d, errno %d, flags:",
- rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
+ (void) printf("pid: %ld, seq %d, errno %d, flags:",
+ (long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
bprintf(stdout, rtm->rtm_flags, routeflags);
pmsg_common(rtm);
}
diff --git a/sbin/routed/table.c b/sbin/routed/table.c
index 2aefbbc9ea7..584ff692e12 100644
--- a/sbin/routed/table.c
+++ b/sbin/routed/table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.c,v 1.7 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: table.c,v 1.8 2002/05/26 09:24:35 deraadt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -1091,7 +1091,7 @@ read_rt(void)
strcpy(str, rtm_type_name(m.r.rtm.rtm_type));
strp = &str[strlen(str)];
if (m.r.rtm.rtm_type <= RTM_CHANGE)
- strp += sprintf(strp," from pid %d",m.r.rtm.rtm_pid);
+ strp += sprintf(strp," from pid %ld", (long)m.r.rtm.rtm_pid);
rt_xaddrs(&info, m.r.addrs, &m.r.addrs[RTAX_MAX],
m.r.rtm.rtm_addrs);
diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c
index bd8770f1fa4..71a01c6f3f4 100644
--- a/sbin/shutdown/shutdown.c
+++ b/sbin/shutdown/shutdown.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shutdown.c,v 1.24 2002/02/16 21:27:38 millert Exp $ */
+/* $OpenBSD: shutdown.c,v 1.25 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)shutdown.c 8.2 (Berkeley) 2/16/94";
#else
-static char rcsid[] = "$OpenBSD: shutdown.c,v 1.24 2002/02/16 21:27:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: shutdown.c,v 1.25 2002/05/26 09:24:35 deraadt Exp $";
#endif
#endif /* not lint */
@@ -229,13 +229,13 @@ main(argc, argv)
#else
(void)setpriority(PRIO_PROCESS, 0, PRIO_MIN);
{
- int forkpid;
+ pid_t forkpid;
forkpid = fork();
if (forkpid == -1)
err(1, "fork");
if (forkpid) {
- (void)printf("shutdown: [pid %d]\n", forkpid);
+ (void)printf("shutdown: [pid %ld]\n", (long)forkpid);
exit(0);
}
}
diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c
index 0a8bd7280fb..10aa62fe797 100644
--- a/sbin/slattach/slattach.c
+++ b/sbin/slattach/slattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slattach.c,v 1.12 2002/02/16 21:27:38 millert Exp $ */
+/* $OpenBSD: slattach.c,v 1.13 2002/05/26 09:24:35 deraadt Exp $ */
/* $NetBSD: slattach.c,v 1.17 1996/05/19 21:57:39 jonathan Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)slattach.c 8.2 (Berkeley) 1/7/94";
#else
-static char rcsid[] = "$OpenBSD: slattach.c,v 1.12 2002/02/16 21:27:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: slattach.c,v 1.13 2002/05/26 09:24:35 deraadt Exp $";
#endif
#endif /* not lint */
@@ -168,7 +168,7 @@ main(argc, argv)
"%sslip.%s.pid", _PATH_VARRUN, dev + i);
truncate(pidfilename, 0); /* If this fails, so will the next one... */
if ((pidfile = fopen(pidfilename, "w")) != NULL) {
- fprintf(pidfile, "%d\n", pid);
+ fprintf(pidfile, "%ld\n", (long)pid);
(void) fclose(pidfile);
} else {
syslog(LOG_ERR, "Failed to create pid file %s: %m", pidfilename);
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 1b6d4249881..4c6e19a4119 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.21 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: arp.c,v 1.22 2002/05/26 09:25:21 deraadt Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -45,7 +45,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)arp.c 8.2 (Berkeley) 1/2/94";*/
-static char *rcsid = "$OpenBSD: arp.c,v 1.21 2002/03/14 16:44:24 mpech Exp $";
+static char *rcsid = "$OpenBSD: arp.c,v 1.22 2002/05/26 09:25:21 deraadt Exp $";
#endif /* not lint */
/*
@@ -91,7 +91,7 @@ int rtmsg(int);
int set(int, char **);
void usage(void);
-static int pid;
+static pid_t pid;
static int nflag; /* no reverse dns lookups */
static int aflag; /* do it for all entries */
static int s = -1;
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index ce500e4a3d2..74c8ac0bb9f 100644
--- a/usr.sbin/edquota/edquota.c
+++ b/usr.sbin/edquota/edquota.c
@@ -42,7 +42,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)edquota.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: edquota.c,v 1.30 2002/03/14 16:44:24 mpech Exp $";
+static char *rcsid = "$Id: edquota.c,v 1.31 2002/05/26 09:25:21 deraadt Exp $";
#endif /* not lint */
/*
@@ -361,10 +361,11 @@ int
editit(tmpfile)
char *tmpfile;
{
- int pid, stat, xpid;
+ pid_t pid, xpid;
char *argp[] = {"sh", "-c", NULL, NULL};
char *ed, *p;
sigset_t mask, omask;
+ int stat;
if ((ed = getenv("EDITOR")) == (char *)0)
ed = _PATH_VI;
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 83942678bca..0611971dc9e 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.90 2002/05/22 09:09:32 deraadt Exp $ */
+/* $OpenBSD: inetd.c,v 1.91 2002/05/26 09:25:21 deraadt Exp $ */
/* $NetBSD: inetd.c,v 1.11 1996/02/22 11:14:41 mycroft Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
-static char rcsid[] = "$OpenBSD: inetd.c,v 1.90 2002/05/22 09:09:32 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: inetd.c,v 1.91 2002/05/26 09:25:21 deraadt Exp $";
#endif /* not lint */
/*
@@ -646,8 +646,8 @@ main(argc, argv, envp)
sep->se_proto);
}
if (debug)
- fprintf(stderr, "%d execl %s\n",
- getpid(), sep->se_server);
+ fprintf(stderr, "%ld execl %s\n",
+ (long)getpid(), sep->se_server);
dup2(ctrl, 0);
close(ctrl);
dup2(0, 1);
@@ -730,9 +730,9 @@ reap(int sig)
void
doreap(void)
{
- pid_t pid;
- int status;
struct servtab *sep;
+ int status;
+ pid_t pid;
if (debug)
fprintf(stderr, "reaping asked for\n");
@@ -742,7 +742,8 @@ doreap(void)
if (pid <= 0)
break;
if (debug)
- fprintf(stderr, "%d reaped, status %x\n", pid, status);
+ fprintf(stderr, "%ld reaped, status %x\n",
+ (long)pid, status);
for (sep = servtab; sep; sep = sep->se_next)
if (sep->se_wait == pid) {
if (WIFEXITED(status) && WEXITSTATUS(status))
@@ -1740,7 +1741,7 @@ logpid()
FILE *fp;
if ((fp = fopen(_PATH_INETDPID, "w")) != NULL) {
- fprintf(fp, "%u\n", getpid());
+ fprintf(fp, "%ld\n", (long)getpid());
(void)fclose(fp);
}
}
diff --git a/usr.sbin/mopd/mopd/mopd.c b/usr.sbin/mopd/mopd/mopd.c
index 1988707b45a..6b4ff52126d 100644
--- a/usr.sbin/mopd/mopd/mopd.c
+++ b/usr.sbin/mopd/mopd/mopd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mopd.c,v 1.5 2002/02/16 21:28:04 millert Exp $ */
+/* $OpenBSD: mopd.c,v 1.6 2002/05/26 09:25:21 deraadt Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@@ -30,7 +30,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: mopd.c,v 1.5 2002/02/16 21:28:04 millert Exp $";
+static char rcsid[] = "$OpenBSD: mopd.c,v 1.6 2002/05/26 09:25:21 deraadt Exp $";
#endif
/*
@@ -82,8 +82,9 @@ main(argc, argv)
int argc;
char **argv;
{
- int c, pid, devnull, f;
+ int c, devnull, f;
char *interface;
+ pid_t pid;
extern int optind;
extern char version[];
diff --git a/usr.sbin/pppd/ipxcp.c b/usr.sbin/pppd/ipxcp.c
index a5fc1b7b3fa..634c363f64c 100644
--- a/usr.sbin/pppd/ipxcp.c
+++ b/usr.sbin/pppd/ipxcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipxcp.c,v 1.7 2002/02/17 19:42:38 millert Exp $ */
+/* $OpenBSD: ipxcp.c,v 1.8 2002/05/26 09:25:21 deraadt Exp $ */
/*
* ipxcp.c - PPP IPX Control Protocol.
@@ -24,7 +24,7 @@
#if 0
static char rcsid[] = "Id: ipxcp.c,v 1.6 1998/03/25 03:08:16 paulus Exp $";
#else
-static char rcsid[] = "$OpenBSD: ipxcp.c,v 1.7 2002/02/17 19:42:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: ipxcp.c,v 1.8 2002/05/26 09:25:21 deraadt Exp $";
#endif
#endif
@@ -1215,7 +1215,7 @@ ipxcp_script(f, script)
char strnetwork[32], strpid[32];
char *argv[14], strproto_lcl[32], strproto_rmt[32];
- sprintf (strpid, "%d", getpid());
+ sprintf (strpid, "%ld", (long)getpid());
sprintf (strspeed, "%d", baud_rate);
strproto_lcl[0] = '\0';
diff --git a/usr.sbin/pppd/magic.c b/usr.sbin/pppd/magic.c
index 0fef78c87e2..f054f397759 100644
--- a/usr.sbin/pppd/magic.c
+++ b/usr.sbin/pppd/magic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magic.c,v 1.5 2002/02/16 21:28:07 millert Exp $ */
+/* $OpenBSD: magic.c,v 1.6 2002/05/26 09:25:21 deraadt Exp $ */
/*
* magic.c - PPP Magic Number routines.
@@ -23,7 +23,7 @@
#if 0
static char rcsid[] = "Id: magic.c,v 1.7 1998/03/25 03:07:49 paulus Exp $";
#else
-static char rcsid[] = "$OpenBSD: magic.c,v 1.5 2002/02/16 21:28:07 millert Exp $";
+static char rcsid[] = "$OpenBSD: magic.c,v 1.6 2002/05/26 09:25:21 deraadt Exp $";
#endif
#endif
@@ -48,12 +48,14 @@ extern void srand48(long);
void
magic_init()
{
+#if 0
long seed;
struct timeval t;
gettimeofday(&t, NULL);
seed = get_host_seed() ^ t.tv_sec ^ t.tv_usec ^ getpid();
srand48(seed);
+#endif
}
/*
@@ -62,7 +64,11 @@ magic_init()
u_int32_t
magic()
{
+#if 0
return (u_int32_t) mrand48();
+#else
+ return arc4random();
+#endif
}
#ifdef NO_DRAND48
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index c521b8830ba..b45a9180874 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.36 2002/05/08 22:30:55 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.37 2002/05/26 09:25:21 deraadt Exp $ */
/*
* main.c - Point-to-Point Protocol main module
@@ -23,7 +23,7 @@
#if 0
static char rcsid[] = "Id: main.c,v 1.49 1998/05/05 05:24:17 paulus Exp $";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.36 2002/05/08 22:30:55 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.37 2002/05/26 09:25:21 deraadt Exp $";
#endif
#endif
@@ -640,7 +640,7 @@ create_pidfile()
(void) sprintf(pidfilename, "%s%s.pid", _PATH_VARRUN, ifname);
if ((pidfile = fopen(pidfilename, "w")) != NULL) {
- fprintf(pidfile, "%d\n", pid);
+ fprintf(pidfile, "%ld\n", (long)pid);
(void) fclose(pidfile);
} else {
syslog(LOG_ERR, "Failed to create pid file %s: %m", pidfilename);
@@ -1080,7 +1080,7 @@ device_script(program, in, out)
char *program;
int in, out;
{
- int pid;
+ pid_t pid;
int status;
int errfd;
@@ -1157,7 +1157,7 @@ run_program(prog, args, must_exist)
char **args;
int must_exist;
{
- int pid;
+ pid_t pid;
pid = fork();
if (pid == -1) {
@@ -1207,7 +1207,7 @@ run_program(prog, args, must_exist)
syslog(LOG_WARNING, "Can't execute %s: %m", prog);
_exit(1);
}
- MAINDEBUG((LOG_DEBUG, "Script %s started; pid = %d", prog, pid));
+ MAINDEBUG((LOG_DEBUG, "Script %s started; pid = %ld", prog, (long)pid));
++n_children;
return 0;
}
@@ -1220,7 +1220,8 @@ run_program(prog, args, must_exist)
static void
reap_kids()
{
- int pid, status;
+ int status;
+ pid_t pid;
if (n_children == 0)
return;
@@ -1232,8 +1233,8 @@ reap_kids()
if (pid > 0) {
--n_children;
if (WIFSIGNALED(status)) {
- syslog(LOG_WARNING, "Child process %d terminated with signal %d",
- pid, WTERMSIG(status));
+ syslog(LOG_WARNING, "Child process %ld terminated with signal %d",
+ (long)pid, WTERMSIG(status));
}
}
}
diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c
index 8c079afb03d..6c062afdbfb 100644
--- a/usr.sbin/pppd/sys-bsd.c
+++ b/usr.sbin/pppd/sys-bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys-bsd.c,v 1.16 2002/02/16 21:28:07 millert Exp $ */
+/* $OpenBSD: sys-bsd.c,v 1.17 2002/05/26 09:25:21 deraadt Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -26,7 +26,7 @@
#if 0
static char rcsid[] = "Id: sys-bsd.c,v 1.31 1998/04/02 12:04:19 paulus Exp $";
#else
-static char rcsid[] = "$OpenBSD: sys-bsd.c,v 1.16 2002/02/16 21:28:07 millert Exp $";
+static char rcsid[] = "$OpenBSD: sys-bsd.c,v 1.17 2002/05/26 09:25:21 deraadt Exp $";
#endif
#endif
@@ -1535,7 +1535,8 @@ lock(dev)
char *dev;
{
char hdb_lock_buffer[12];
- int fd, pid, n;
+ int fd, n;
+ pid_t pid;
char *p;
if ((p = strrchr(dev, '/')) != NULL)
@@ -1560,15 +1561,15 @@ lock(dev)
/* pid no longer exists - remove the lock file */
if (unlink(lock_file) == 0) {
close(fd);
- syslog(LOG_NOTICE, "Removed stale lock on %s (pid %d)",
- dev, pid);
+ syslog(LOG_NOTICE, "Removed stale lock on %s (pid %ld)",
+ dev, (long)pid);
continue;
} else
syslog(LOG_WARNING, "Couldn't remove stale lock on %s",
dev);
} else
- syslog(LOG_NOTICE, "Device %s is locked by pid %d",
- dev, pid);
+ syslog(LOG_NOTICE, "Device %s is locked by pid %ld",
+ dev, (long)pid);
}
close(fd);
} else
@@ -1578,7 +1579,7 @@ lock(dev)
return -1;
}
- sprintf(hdb_lock_buffer, "%10d\n", getpid());
+ sprintf(hdb_lock_buffer, "%10ld\n", (long)getpid());
write(fd, hdb_lock_buffer, 11);
close(fd);
diff --git a/usr.sbin/rarpd/arptab.c b/usr.sbin/rarpd/arptab.c
index 2edc7663792..531d964c35d 100644
--- a/usr.sbin/rarpd/arptab.c
+++ b/usr.sbin/rarpd/arptab.c
@@ -74,7 +74,7 @@ static char sccsid[] = "@(#)arp.c 8.2 (Berkeley) 1/2/94";
#include <syslog.h>
#include <string.h>
-static int pid;
+static pid_t pid;
static int s = -1;
void
diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c
index 484c5c0c370..d625267702e 100644
--- a/usr.sbin/rarpd/rarpd.c
+++ b/usr.sbin/rarpd/rarpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rarpd.c,v 1.35 2002/03/14 16:44:25 mpech Exp $ */
+/* $OpenBSD: rarpd.c,v 1.36 2002/05/26 09:25:21 deraadt Exp $ */
/* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */
/*
@@ -28,7 +28,7 @@ char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "$OpenBSD: rarpd.c,v 1.35 2002/03/14 16:44:25 mpech Exp $";
+static char rcsid[] = "$OpenBSD: rarpd.c,v 1.36 2002/05/26 09:25:21 deraadt Exp $";
#endif
@@ -118,11 +118,12 @@ main(argc, argv)
int argc;
char **argv;
{
- int op, pid, devnull, f;
+ int op, devnull, f;
char *ifname, *hostname;
extern char *__progname;
extern char *optarg;
extern int optind, opterr;
+ pid_t pid;
/* All error reporting is done through syslogs. */
openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON);
diff --git a/usr.sbin/rpc.pcnfsd/pcnfsd_misc.c b/usr.sbin/rpc.pcnfsd/pcnfsd_misc.c
index 93ae185c207..3094ff81de8 100644
--- a/usr.sbin/rpc.pcnfsd/pcnfsd_misc.c
+++ b/usr.sbin/rpc.pcnfsd/pcnfsd_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcnfsd_misc.c,v 1.4 2001/08/19 19:16:12 ericj Exp $ */
+/* $OpenBSD: pcnfsd_misc.c,v 1.5 2002/05/26 09:25:22 deraadt Exp $ */
/* $NetBSD: pcnfsd_misc.c,v 1.2 1995/07/25 22:20:42 gwr Exp $ */
/* RE_SID: @(%)/usr/dosnfs/shades_SCCS/unix/pcnfsd/v2/src/SCCS/s.pcnfsd_misc.c 1.5 92/01/24 19:59:13 SMI */
@@ -163,7 +163,7 @@ wlogin(name, req)
#define READER_FD 0
#define WRITER_FD 1
-static int child_pid;
+static pid_t child_pid;
static char cached_user[64] = "";
static uid_t cached_uid;
@@ -238,7 +238,8 @@ su_popen(user, cmd, maxtime)
int maxtime;
{
int p[2];
- int parent_fd, child_fd, pid;
+ int parent_fd, child_fd;
+ pid_t pid;
struct passwd *pw;
if (strcmp(cached_user, user)) {
@@ -296,14 +297,16 @@ int
su_pclose(ptr)
FILE *ptr;
{
- int pid, status;
+ int status;
+ pid_t pid;
stop_watchdog();
fclose(ptr);
if (child_pid == -1)
return (-1);
- while ((pid = wait(&status)) != child_pid && pid != -1);
+ while ((pid = wait(&status)) != child_pid && pid != -1)
+ ;
return (pid == -1 ? -1 : status);
}
diff --git a/usr.sbin/screenblank/screenblank.c b/usr.sbin/screenblank/screenblank.c
index 9685c3d4b7d..c2e45365dc3 100644
--- a/usr.sbin/screenblank/screenblank.c
+++ b/usr.sbin/screenblank/screenblank.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screenblank.c,v 1.12 2002/02/16 21:28:09 millert Exp $ */
+/* $OpenBSD: screenblank.c,v 1.13 2002/05/26 09:25:22 deraadt Exp $ */
/* $NetBSD: screenblank.c,v 1.2 1996/02/28 01:18:34 thorpej Exp $ */
/*-
@@ -342,7 +342,7 @@ logpid()
FILE *fp;
if ((fp = fopen(_PATH_SCREENBLANKPID, "w")) != NULL) {
- fprintf(fp, "%u\n", getpid());
+ fprintf(fp, "%ld\n", (long)getpid());
(void)fclose(fp);
}
}
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index e75647b39fa..c13b527e732 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.50 2002/05/25 13:54:03 fgsch Exp $ */
+/* $OpenBSD: syslogd.c,v 1.51 2002/05/26 09:25:22 deraadt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-static char rcsid[] = "$OpenBSD: syslogd.c,v 1.50 2002/05/25 13:54:03 fgsch Exp $";
+static char rcsid[] = "$OpenBSD: syslogd.c,v 1.51 2002/05/26 09:25:22 deraadt Exp $";
#endif
#endif /* not lint */
@@ -354,7 +354,7 @@ main(argc, argv)
if (!Debug) {
fp = fopen(PidFile, "w");
if (fp != NULL) {
- fprintf(fp, "%d\n", getpid());
+ fprintf(fp, "%ld\n", (long)getpid());
(void) fclose(fp);
}
}