summaryrefslogtreecommitdiffstats
path: root/usr.sbin/inetd
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-07-27 10:06:10 +0000
committerclaudio <claudio@openbsd.org>2008-07-27 10:06:10 +0000
commit2c4a6bc86b1630dbde7b1b629f91ac36bb3dd2d8 (patch)
tree06185aca087b8367aaca5617f65d8cca2b09878b /usr.sbin/inetd
parentGet TAILQ_REPLACE and CIRCLEQ_REPLACE prototypes right. (diff)
downloadwireguard-openbsd-2c4a6bc86b1630dbde7b1b629f91ac36bb3dd2d8.tar.xz
wireguard-openbsd-2c4a6bc86b1630dbde7b1b629f91ac36bb3dd2d8.zip
Use __progname instead of hand rolled version using argv[0].
Diff from Gleydson Soares gsoares at gmail dot com OK millert@
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r--usr.sbin/inetd/inetd.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 8031cec7a22..4729c55a651 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.128 2008/06/28 10:54:45 sobrado Exp $ */
+/* $OpenBSD: inetd.c,v 1.129 2008/07/27 10:06:10 claudio Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -37,7 +37,7 @@ char copyright[] =
#ifndef lint
/*static const char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
-static const char rcsid[] = "$OpenBSD: inetd.c,v 1.128 2008/06/28 10:54:45 sobrado Exp $";
+static const char rcsid[] = "$OpenBSD: inetd.c,v 1.129 2008/07/27 10:06:10 claudio Exp $";
#endif /* not lint */
/*
@@ -300,7 +300,7 @@ int dg_broadcast(struct in_addr *in);
#define NUMINT (sizeof(intab) / sizeof(struct inent))
char *CONFIG = _PATH_INETDCONF;
-char *progname;
+extern char *__progname;
void
fd_grow(fd_set **fdsp, int *bytes, int fd)
@@ -332,10 +332,7 @@ main(int argc, char *argv[])
struct servtab *sep;
extern char *optarg;
extern int optind;
-
- progname = strrchr(argv[0], '/');
- progname = progname ? progname + 1 : argv[0];
-
+
while ((ch = getopt(argc, argv, "dR:")) != -1)
switch (ch) {
case 'd':
@@ -360,7 +357,7 @@ main(int argc, char *argv[])
default:
fprintf(stderr,
"usage: %s [-d] [-R rate] [configuration_file]\n",
- progname);
+ __progname);
exit(1);
}
argc -= optind;
@@ -373,12 +370,12 @@ main(int argc, char *argv[])
CONFIG = argv[0];
if (CONFIG == NULL) {
fprintf(stderr, "%s: non-root must specify a config file\n",
- progname);
+ __progname);
exit(1);
}
if (argc > 1) {
fprintf(stderr, "%s: more than one argument specified\n",
- progname);
+ __progname);
exit(1);
}
@@ -396,7 +393,7 @@ main(int argc, char *argv[])
setgroups(1, &gid);
}
- openlog(progname, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
+ openlog(__progname, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
logpid();
if (getrlimit(RLIMIT_NOFILE, &rlim_nofile) < 0) {