044fb677fb
- cleanup port from brad tested by aja@ edd@
34 lines
822 B
Plaintext
34 lines
822 B
Plaintext
$OpenBSD: patch-src_ircd_c,v 1.2 2011/10/19 13:46:17 jasper Exp $
|
|
--- src/ircd.c.orig Thu Aug 18 12:21:47 2011
|
|
+++ src/ircd.c Fri Oct 14 16:13:29 2011
|
|
@@ -144,7 +144,6 @@ make_daemon(void)
|
|
}
|
|
else if (pid > 0)
|
|
{
|
|
- print_startup(pid);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
@@ -488,8 +487,19 @@ main(int argc, char *argv[])
|
|
*/
|
|
if (geteuid() == 0)
|
|
{
|
|
- fprintf(stderr, "Don't run ircd as root!!!\n");
|
|
- return -1;
|
|
+ struct passwd *pw;
|
|
+
|
|
+ if ((pw = getpwnam(IRCD_USER)) == NULL)
|
|
+ {
|
|
+ fprintf(stderr, "Don't run ircd as root!!!\n");
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) < 0)
|
|
+ {
|
|
+ fprintf(stderr, "Can's set user context to %s!\n", IRCD_USER);
|
|
+ return -1;
|
|
+ }
|
|
}
|
|
|
|
/* Setup corefile size immediately after boot -kre */
|