ctdb-tests: Avoid portability issue in porting tests
authorMartin Schwenke <martin@meltin.net>
Wed, 27 Jul 2016 05:24:58 +0000 (15:24 +1000)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Jul 2016 03:00:18 +0000 (05:00 +0200)
EUID is bash-only, so this condition always fails on other shells.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/cunit/porting_tests_001.sh

index 5612c99034f30f42aa00b41be3fdff98a4ac49ec..2b030079da4164028b65823b2585b0f92176bb74 100755 (executable)
@@ -11,7 +11,8 @@ remove_socket ()
 
 test_cleanup remove_socket
 
-if [ $EUID -eq 0 ] ; then
+uid=$(id -u)
+if [ "$uid" -eq 0 ] ; then
     ok "../common/system_linux.c:607 interface 'fake' not found"
 else
     ok "../common/system_linux.c:601 failed to open raw socket"