summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-16 09:07:23 +0000
committerbrian <brian@FreeBSD.org>2000-08-16 09:07:23 +0000
commita7aa2e6cdb6c5521e4c444686f843a5ec015f6c2 (patch)
treef92a54d342123c82413213bce4839e5b3df8ae48 /usr.sbin
parent724f61b07d51e05677c46e23e943f24eac26cf11 (diff)
downloadFreeBSD-src-a7aa2e6cdb6c5521e4c444686f843a5ec015f6c2.zip
FreeBSD-src-a7aa2e6cdb6c5521e4c444686f843a5ec015f6c2.tar.gz
setproctitle() doesn't need to be called with root privs, so move
it from id.c into defs.c
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/bundle.c3
-rw-r--r--usr.sbin/ppp/command.c9
-rw-r--r--usr.sbin/ppp/defs.c16
-rw-r--r--usr.sbin/ppp/defs.h1
-rw-r--r--usr.sbin/ppp/id.c18
-rw-r--r--usr.sbin/ppp/id.h1
6 files changed, 20 insertions, 28 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 3e3e41f..00308c9 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -51,7 +51,6 @@
#include <sys/uio.h>
#include <sys/wait.h>
#if defined(__FreeBSD__) && !defined(NOKLDLOAD)
-#include <sys/linker.h>
#include <sys/module.h>
#endif
#include <termios.h>
@@ -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 f1b0be1..5b3c9e0 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -33,11 +33,6 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#ifdef __OpenBSD__
-#include <util.h>
-#else
-#include <libutil.h>
-#endif
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
@@ -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 c7577c2..7101dd8 100644
--- a/usr.sbin/ppp/defs.c
+++ b/usr.sbin/ppp/defs.c
@@ -35,6 +35,11 @@
#include <ctype.h>
#include <errno.h>
+#ifdef __OpenBSD__
+#include <util.h>
+#else
+#include <libutil.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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 402bd18..d339b07 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 7f99a8a..8950239 100644
--- a/usr.sbin/ppp/id.c
+++ b/usr.sbin/ppp/id.c
@@ -38,7 +38,6 @@
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
-#include <stdlib.h> /* setproctitle() under OpenBSD (+NetBSD ?)*/
#include <string.h>
#include <sysexits.h>
#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 11cb831..8c48767 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
OpenPOWER on IntegriCloud