From 865faff95d195731bc635a0ecb6b82240bdf01ad Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Mon, 20 Dec 1999 16:32:54 +0000 Subject: rcsid police. pathname change (/usr/local/v6/libexec -> /usr/libexec) bring in some of kame fixes (sprintf -> snprintf, proc title). --- usr.sbin/faithd/faithd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'usr.sbin/faithd/faithd.c') 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); -- cgit v1.2.3