summaryrefslogtreecommitdiff
path: root/usr.sbin/faithd
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-05-15 00:26:56 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-05-15 00:26:56 +0000
commit1b15961420fef73ec94f74c7b3fc2433091d7b99 (patch)
tree98d7cb15dd087cce4d09162a293c2fab8019cc04 /usr.sbin/faithd
parent333ac4165eece30194825c1f7e2a9d0bc94636b1 (diff)
simplify by strdup. expilcitly specify IPPROTO_TCP (to cope with sctp-ready
getaddrinfo).
Diffstat (limited to 'usr.sbin/faithd')
-rw-r--r--usr.sbin/faithd/faithd.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/faithd/faithd.c b/usr.sbin/faithd/faithd.c
index 6bb06d0c6f7..20ccc1dfb9a 100644
--- a/usr.sbin/faithd/faithd.c
+++ b/usr.sbin/faithd/faithd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: faithd.c,v 1.23 2003/03/13 09:09:46 deraadt Exp $ */
+/* $OpenBSD: faithd.c,v 1.24 2003/05/15 00:26:55 itojun Exp $ */
/* $KAME: faithd.c,v 1.58 2002/09/08 01:12:30 itojun Exp $ */
/*
@@ -266,18 +266,13 @@ daemon_main(int argc, char **argv)
if (serverargc >= MAXARGV)
exit_stderr("too many arguments");
- len = strlen(argv[NUMPRG]) + 1;
- serverpath = malloc(len);
+ serverpath = strdup(argv[NUMPRG]);
if (!serverpath)
exit_stderr("not enough core");
- strlcpy(serverpath, argv[NUMPRG], len);
for (i = 0; i < serverargc; i++) {
- int len = strlen(argv[i + NUMARG]) + 1;
-
- serverarg[i] = malloc(len);
+ serverarg[i] = strdup(argv[i + NUMARG]);
if (!serverarg[i])
exit_stderr("not enough core");
- strlcpy(serverarg[i], argv[i + NUMARG], len);
}
serverarg[i] = NULL;
/* fall throuth */
@@ -297,7 +292,7 @@ daemon_main(int argc, char **argv)
hints.ai_flags = AI_PASSIVE;
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = 0;
+ hints.ai_protocol = IPPROTO_TCP;
error = getaddrinfo(NULL, service, &hints, &res);
if (error)
exit_failure("getaddrinfo: %s", gai_strerror(error));