diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-29 09:45:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-29 09:45:09 +0000 |
commit | b19caa201f0c1b7d209365f918f8322db3d568f1 (patch) | |
tree | 514074de149a63767f65aa2125ba2e1465960b7e /usr.sbin | |
parent | e202c9c7632308262151bf90c05613696fe91270 (diff) |
more sprintf
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/popa3d/standalone.c | 16 | ||||
-rw-r--r-- | usr.sbin/quotaon/quotaon.c | 11 | ||||
-rw-r--r-- | usr.sbin/rbootd/bpf.c | 6 | ||||
-rw-r--r-- | usr.sbin/repquota/repquota.c | 9 | ||||
-rw-r--r-- | usr.sbin/rmt/rmt.c | 10 |
5 files changed, 28 insertions, 24 deletions
diff --git a/usr.sbin/popa3d/standalone.c b/usr.sbin/popa3d/standalone.c index da8d60f19f7..f563e349932 100644 --- a/usr.sbin/popa3d/standalone.c +++ b/usr.sbin/popa3d/standalone.c @@ -1,4 +1,4 @@ -/* $OpenBSD: standalone.c,v 1.2 2001/09/21 20:22:06 camield Exp $ */ +/* $OpenBSD: standalone.c,v 1.3 2002/05/29 09:45:08 deraadt Exp $ */ /* * Standalone POP server: accepts connections, checks the anti-flood limits, @@ -62,7 +62,7 @@ static va_int child_pending; /* Are any dead children waiting? */ static void handle_child(int signum) { int saved_errno; - int pid; + pid_t pid; int i; saved_errno = errno; @@ -73,11 +73,11 @@ static void handle_child(int signum) child_pending = 0; while ((pid = waitpid(0, NULL, WNOHANG)) > 0) - for (i = 0; i < MAX_SESSIONS; i++) - if (sessions[i].pid == pid) { - sessions[i].pid = 0; - break; - } + for (i = 0; i < MAX_SESSIONS; i++) + if (sessions[i].pid == pid) { + sessions[i].pid = 0; + break; + } } if (signum) signal(SIGCHLD, handle_child); @@ -115,7 +115,7 @@ int main(void) int sock, new; struct sockaddr_in addr; int addrlen; - int pid; + pid_t pid; struct tms buf; clock_t now; int i, j, n; diff --git a/usr.sbin/quotaon/quotaon.c b/usr.sbin/quotaon/quotaon.c index f606df31eca..1fd093a4d87 100644 --- a/usr.sbin/quotaon/quotaon.c +++ b/usr.sbin/quotaon/quotaon.c @@ -42,7 +42,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)quotaon.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: quotaon.c,v 1.13 2002/05/22 09:09:32 deraadt Exp $"; +static char *rcsid = "$Id: quotaon.c,v 1.14 2002/05/29 09:45:08 deraadt Exp $"; #endif /* not lint */ /* @@ -215,8 +215,10 @@ hasquota(fs, type, qfnamep, force) static char buf[BUFSIZ]; if (!initname) { - sprintf(usrname, "%s%s", qfextension[USRQUOTA], qfname); - sprintf(grpname, "%s%s", qfextension[GRPQUOTA], qfname); + snprintf(usrname, sizeof usrname, "%s%s", + qfextension[USRQUOTA], qfname); + snprintf(grpname, sizeof grpname, "%s%s", + qfextension[GRPQUOTA], qfname); initname = 1; } strlcpy(buf, fs->fs_mntops, sizeof buf); @@ -234,7 +236,8 @@ hasquota(fs, type, qfnamep, force) *qfnamep = cp; return (1); } - (void) sprintf(buf, "%s/%s.%s", fs->fs_file, qfname, qfextension[type]); + (void) snprintf(buf, sizeof buf, "%s/%s.%s", fs->fs_file, + qfname, qfextension[type]); *qfnamep = buf; return (1); } diff --git a/usr.sbin/rbootd/bpf.c b/usr.sbin/rbootd/bpf.c index 9de116d7f58..a0c6f7aad9a 100644 --- a/usr.sbin/rbootd/bpf.c +++ b/usr.sbin/rbootd/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.8 2002/05/27 19:48:42 deraadt Exp $ */ +/* $OpenBSD: bpf.c,v 1.9 2002/05/29 09:45:08 deraadt Exp $ */ /* $NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $ */ /* @@ -49,7 +49,7 @@ #ifndef lint /*static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$OpenBSD: bpf.c,v 1.8 2002/05/27 19:48:42 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: bpf.c,v 1.9 2002/05/29 09:45:08 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -97,7 +97,7 @@ BpfOpen() * Open the first available BPF device. */ do { - (void) sprintf(bpfdev, _PATH_BPF, n++); + (void) snprintf(bpfdev, sizeof bpfdev, _PATH_BPF, n++); BpfFd = open(bpfdev, O_RDWR); } while (BpfFd < 0 && (errno == EBUSY || errno == EPERM)); diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c index 269bfeebecc..e63edea5356 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -42,7 +42,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)repquota.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: repquota.c,v 1.16 2002/03/14 16:44:25 mpech Exp $"; +static char *rcsid = "$Id: repquota.c,v 1.17 2002/05/29 09:45:08 deraadt Exp $"; #endif /* not lint */ /* @@ -388,13 +388,14 @@ timeprt(seconds) minutes = (seconds + 30) / 60; hours = (minutes + 30) / 60; if (hours >= 36) { - sprintf(buf, "%ddays", (hours + 12) / 24); + snprintf(buf, sizeof buf, "%ddays", (hours + 12) / 24); return (buf); } if (minutes >= 60) { - sprintf(buf, "%2d:%d", minutes / 60, minutes % 60); + snprintf(buf, sizeof buf, "%2d:%d", minutes / 60, + minutes % 60); return (buf); } - sprintf(buf, "%2d", minutes); + snprintf(buf, sizeof buf, "%2d", minutes); return (buf); } diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c index 141eef14210..5b128585649 100644 --- a/usr.sbin/rmt/rmt.c +++ b/usr.sbin/rmt/rmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rmt.c,v 1.7 2002/02/16 21:28:08 millert Exp $ */ +/* $OpenBSD: rmt.c,v 1.8 2002/05/29 09:45:08 deraadt Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rmt.c 5.6 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: rmt.c,v 1.7 2002/02/16 21:28:08 millert Exp $"; +static char rcsid[] = "$Id: rmt.c,v 1.8 2002/05/29 09:45:08 deraadt Exp $"; #endif /* not lint */ /* @@ -155,7 +155,7 @@ top: rval = read(tape, record, n); if (rval < 0) goto ioerror; - (void) sprintf(resp, "A%d\n", rval); + (void) snprintf(resp, sizeof resp, "A%d\n", rval); (void) write(1, resp, strlen(resp)); (void) write(1, record, rval); goto top; @@ -178,7 +178,7 @@ top: if (ioctl(tape, MTIOCGET, (char *)&mtget) == -1) goto ioerror; rval = sizeof (mtget); - (void) sprintf(resp, "A%d\n", rval); + (void) snprintf(resp, sizeof resp, "A%d\n", rval); (void) write(1, resp, strlen(resp)); (void) write(1, (char *)&mtget, sizeof (mtget)); goto top; @@ -190,7 +190,7 @@ top: } respond: DEBUG1("rmtd: A %d\n", rval); - (void) sprintf(resp, "A%d\n", rval); + (void) snprintf(resp, sizeof resp, "A%d\n", rval); (void) write(1, resp, strlen(resp)); goto top; ioerror: |