From 2e38e0ee379454b9e31d0afc24c4efa978246a05 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 10 Nov 2014 16:03:23 +0530 Subject: [PATCH] use seteuid instead of setuid --- bench/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index a87eca09..50dd1c83 100644 --- a/bench/cli.py +++ b/bench/cli.py @@ -35,7 +35,6 @@ def cli(): return bench() def cmd_requires_root(): - print sys.argv if len(sys.argv) > 3 and sys.argv[2] in ('production', 'sudoers'): return True if len(sys.argv) > 2 and sys.argv[1] in ('patch',): @@ -50,7 +49,8 @@ def change_uid(): if is_root() and not cmd_requires_root(): frappe_user = get_config().get('frappe_user') if frappe_user: - os.setuid(pwd.getpwnam(frappe_user).pw_uid) + os.seteuid(pwd.getpwnam(frappe_user).pw_uid) + os.environ['HOME'] = pwd.getpwnam(frappe_user).pw_dir else: print 'You should not run this command as root' sys.exit(1)