aboutsummaryrefslogtreecommitdiffstats
path: root/unix.c
diff options
context:
space:
mode:
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 */