Browse Source

Merge branch 'chroot' into bfgminer

Luke Dashjr 12 years ago
parent
commit
0333de30a1
2 changed files with 6 additions and 2 deletions
  1. 2 0
      AUTHORS
  2. 4 2
      miner.c

+ 2 - 0
AUTHORS

@@ -30,6 +30,8 @@ Olivier Gay <olivier.gay@a3.epfl.ch>
 Glenn Francis Murray <glenn@gfm.cc>
 fleger <florian6.leger@laposte.net>
 pooler <pooler@litecoinpool.org>
+Ricardo Iván Vieitez Parra <cop3504@memoryplate.com>
+Paul Wouters <pwouters@redhat.com>
 Abracadabra <hocuscapocus@gmail.com>
 Josh Lehan <krellan@krellan.net>
 Tydus <Tydus@Tydus.org>

+ 4 - 2
miner.c

@@ -10310,14 +10310,16 @@ int main(int argc, char *argv[])
                 if (chroot(chroot_dir) != 0) {
                        quit(1, "Unable to chroot");
                 }
+		chdir("/");
         }
 #endif
 
 #ifdef HAVE_PWD_H
 		if (user_info != NULL) {
-			if (setgid((*user_info).pw_gid) == 0 && setuid((*user_info).pw_uid) != 0) {
+			if (setgid((*user_info).pw_gid) != 0)
+				quit(1, "Unable to setgid");
+			if (setuid((*user_info).pw_uid) != 0)
 				quit(1, "Unable to setuid");
-			}
 		}
 #endif
 	raise_fd_limits();