Browse Source

use UID==0 rather than username="root" to check if it's a privileged user.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac268@2670 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 14 years ago
parent
commit
d587b0b838
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/bin/auth/tests/change_user_unittest.cc

+ 2 - 2
src/bin/auth/tests/change_user_unittest.cc

@@ -15,6 +15,7 @@
 // $Id$
 
 #include <stdlib.h>
+#include <unistd.h>             // for getuid
 
 #include <string>
 
@@ -49,8 +50,7 @@ TEST_F(ChangeUserTest, badUID) {
 
 TEST_F(ChangeUserTest, promotionAttempt) {
     // change to root should fail unless the running user is a super user.
-
-    if (my_username == "root") {
+    if (getuid() == 0) {
         cerr << "Already a super user, skipping the test" << endl;
         return;
     }