aboutsummaryrefslogtreecommitdiffstats
path: root/unix.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-12-24 19:02:39 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2011-12-24 19:02:39 +0100
commit164352ef9d3e8b4b2eea8ec64c3b4590b2388b18 (patch)
tree58d3424f7743d89ad4f94fc803ddd7e0563ec251 /unix.c
parente306fbf84aa37ab934c5ea18ccfd75da041af052 (diff)
parent96f954df218e81f5580257c319b91217dac2f4bf (diff)
Merging mainline.
Diffstat (limited to 'unix.c')
-rw-r--r--unix.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/unix.c b/unix.c
index 07215c07..2ad2edfc 100644
--- a/unix.c
+++ b/unix.c
@@ -40,6 +40,7 @@
#include <sys/wait.h>
#include <pwd.h>
#include <locale.h>
+#include <grp.h>
#if defined(OTR_BI) || defined(OTR_PI)
#include "otr.h"
@@ -151,9 +152,14 @@ int main( int argc, char *argv[] )
pw = getpwnam( global.conf->user );
if( pw )
{
+ initgroups( global.conf->user, pw->pw_gid );
setgid( pw->pw_gid );
setuid( pw->pw_uid );
}
+ else
+ {
+ log_message( LOGLVL_WARNING, "Failed to look up user %s.", global.conf->user );
+ }
}
/* Catch some signals to tell the user what's happening before quitting */