Commit 0da4a150 authored by deuce's avatar deuce
Browse files

Set USER/HOME/GROUP environment variables when changing uid/gids

(fixes problems with at least some dosemu setups)
parent 766475db
......@@ -1564,6 +1564,19 @@ int main(int argc, char** argv)
else {
char str[256];
struct passwd *pwent;
pwent=getpwnam(new_uid_name);
if(pwent != NULL) {
sprintf(str,"USER=%s",pwent->pw_name);
putenv(str);
sprintf(str,"HOME=%s",pwent->pw_dir);
putenv(str);
}
if(new_gid_name[0]) {
sprintf(str,"GROUP=%s",new_gid_name);
putenv(str);
}
sprintf(str,"Successfully changed user_id to %s", new_uid_name);
bbs_lputs(NULL,LOG_INFO,str);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment