summaryrefslogtreecommitdiff
path: root/usr.sbin/faithd/faithd.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>1999-12-20 16:32:54 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>1999-12-20 16:32:54 +0000
commit865faff95d195731bc635a0ecb6b82240bdf01ad (patch)
tree583eded31cf49fa2f3eda4a89d21d11147538c07 /usr.sbin/faithd/faithd.c
parent05d299e7b204e7e1df159eed593901871dbe66da (diff)
rcsid police.
pathname change (/usr/local/v6/libexec -> /usr/libexec) bring in some of kame fixes (sprintf -> snprintf, proc title).
Diffstat (limited to 'usr.sbin/faithd/faithd.c')
-rw-r--r--usr.sbin/faithd/faithd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/faithd/faithd.c b/usr.sbin/faithd/faithd.c
index d2abde0aaac..74326156381 100644
--- a/usr.sbin/faithd/faithd.c
+++ b/usr.sbin/faithd/faithd.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: faithd.c,v 1.2 1999/12/20 16:32:53 itojun Exp $ */
+
/*
* Copyright (C) 1997 and 1998 WIDE Project.
* All rights reserved.
@@ -83,6 +85,7 @@ char *serverpath = NULL;
char *serverarg[MAXARGV + 1];
static char *faithdname = NULL;
char logname[BUFSIZ];
+char procname[BUFSIZ];
struct myaddrs {
struct myaddrs *next;
struct sockaddr *addr;
@@ -167,7 +170,7 @@ main(int argc, char *argv[])
memset(&ss, 0, sizeof(ss));
memset(&hints, 0, sizeof(hints));
- sprintf(serv, "%u", NAMESERVER_PORT);
+ snprintf(serv, sizeof(serv), "%u", NAMESERVER_PORT);
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(ns, serv, &hints, &res) == 0) {
res_init();
@@ -270,7 +273,8 @@ main(int argc, char *argv[])
start_daemon();
- sprintf(logname, "accepting port %s", service);
+ snprintf(logname, sizeof(logname), "faithd %s", service);
+ snprintf(procname, sizeof(procname), "accepting port %s", service);
openlog(logname, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
syslog(LOG_INFO, "Staring faith daemon for %s port", service);
@@ -294,7 +298,7 @@ play_service(int s_wld)
* Wait, accept, fork, faith....
*/
again:
- setproctitle(logname);
+ setproctitle(procname);
FD_ZERO(&rfds);
FD_SET(s_wld, &rfds);
@@ -640,7 +644,7 @@ exit_error(const char *fmt, ...)
char buf[BUFSIZ];
va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
fprintf(stderr, "%s\n", buf);
exit(EXIT_FAILURE);
@@ -653,7 +657,7 @@ exit_failure(const char *fmt, ...)
char buf[BUFSIZ];
va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
syslog(LOG_ERR, buf);
exit(EXIT_FAILURE);
@@ -666,7 +670,7 @@ exit_success(const char *fmt, ...)
char buf[BUFSIZ];
va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
syslog(LOG_INFO, buf);
exit(EXIT_SUCCESS);