diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 3e3e41f9da81..00308c913a62 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -51,7 +51,6 @@ #include #include #if defined(__FreeBSD__) && !defined(NOKLDLOAD) -#include #include #endif #include @@ -1852,7 +1851,7 @@ bundle_setsid(struct bundle *bundle, int holdsession) */ waitpid(pid, &status, 0); /* Tweak our process arguments.... */ - ID0setproctitle("session owner"); + SetTitle("session owner"); setuid(ID0realuid()); /* * Hang around for a HUP. This should happen as soon as the diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index f1b0be1c2a5f..5b3c9e0b24d1 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -33,11 +33,6 @@ #include #include #include -#ifdef __OpenBSD__ -#include -#else -#include -#endif #include #include #include @@ -2731,7 +2726,7 @@ SetProcTitle(struct cmdargs const *arg) int len, remaining, f, argc = arg->argc - arg->argn; if (arg->argc == arg->argn) { - ID0setproctitle(NULL); + SetTitle(NULL); return 0; } @@ -2757,7 +2752,7 @@ SetProcTitle(struct cmdargs const *arg) } *ptr = '\0'; - ID0setproctitle(title); + SetTitle(title); return 0; } diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c index c7577c21d89f..7101dd817965 100644 --- a/usr.sbin/ppp/defs.c +++ b/usr.sbin/ppp/defs.c @@ -35,6 +35,11 @@ #include #include +#ifdef __OpenBSD__ +#include +#else +#include +#endif #include #include #include @@ -358,3 +363,14 @@ ex_desc(int ex) snprintf(num, sizeof num, "%d", ex); return num; } + +void +SetTitle(const char *title) +{ + if (title == NULL) + setproctitle(NULL); + else if (title[0] == '-' && title[1] != '\0') + setproctitle("-%s", title + 1); + else + setproctitle("%s", title); +} diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index 402bd1888d7f..d339b071212e 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -114,3 +114,4 @@ extern int MakeArgs(char *, char **, int, int); extern const char *NumStr(long, char *, size_t); extern const char *HexStr(long, char *, size_t); extern const char *ex_desc(int); +extern void SetTitle(const char *); diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c index 7f99a8a6494b..8950239eee59 100644 --- a/usr.sbin/ppp/id.c +++ b/usr.sbin/ppp/id.c @@ -38,7 +38,6 @@ #include #include #include -#include /* setproctitle() under OpenBSD (+NetBSD ?)*/ #include #include #if defined(__FreeBSD__) && !defined(NOKLDLOAD) @@ -273,23 +272,6 @@ ID0kill(pid_t pid, int sig) return result; } -void -ID0setproctitle(const char *title) -{ - ID0set0(); - if (title == NULL) { - setproctitle(NULL); - log_Printf(LogID0, "setproctitle(NULL)\n"); - } else { - if (title[0] == '-' && title[1] != '\0') - setproctitle("-%s", title + 1); - else - setproctitle("%s", title); - log_Printf(LogID0, "setproctitle(\"%%s\", \"%s\")\n", title); - } - ID0setuser(); -} - #if defined(__FreeBSD__) && !defined(NOKLDLOAD) int ID0kldload(const char *dev) diff --git a/usr.sbin/ppp/id.h b/usr.sbin/ppp/id.h index 11cb831a45c2..8c487677288f 100644 --- a/usr.sbin/ppp/id.h +++ b/usr.sbin/ppp/id.h @@ -45,7 +45,6 @@ extern void ID0logout(const char *, int); extern int ID0bind_un(int, const struct sockaddr_un *); extern int ID0connect_un(int, const struct sockaddr_un *); extern int ID0kill(pid_t, int); -extern void ID0setproctitle(const char *); #if defined(__FreeBSD__) && !defined(NOKLDLOAD) extern int ID0kldload(const char *); #endif