Skip to content

Commit 944784a

Browse files
syscall: don't assume we have a GETEUID system call
On Alpha GNU/Linux there is no geteuid system call, there is only getresuid. The raw geteuid system call is only used for testing, so just skip the test if it's not available. Change-Id: I2cc972da32d56767f61c8c6f4fa1872f74545c82 Reviewed-on: https://go-review.googlesource.com/137655 Reviewed-by: Cherry Zhang <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent e7b98cf commit 944784a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libgo/go/syscall/syscall_linux_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ func TestSyscallNoError(t *testing.T) {
302302
t.Skip("skipping root only test")
303303
}
304304

305+
if syscall.Sys_GETEUID == 0 {
306+
t.Skip("skipping because there is no geteuid system call")
307+
}
308+
305309
// Copy the test binary to a location that a non-root user can read/execute
306310
// after we drop privileges
307311
tempDir, err := ioutil.TempDir("", "TestSyscallNoError")

libgo/mksysinfo.sh

+6
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ if ! grep '^const SYS_GETDENTS64 ' ${OUT} >/dev/null 2>&1; then
138138
echo "const SYS_GETDENTS64 = 0" >> ${OUT}
139139
fi
140140

141+
# The syscall package wants the geteuid system call number. It isn't
142+
# defined on Alpha, which only provides the getresuid system call.
143+
if ! grep '^const SYS_GETEUID ' ${OUT} >/dev/null 2>&1; then
144+
echo "const SYS_GETEUID = 0" >> ${OUT}
145+
fi
146+
141147
# Stat constants.
142148
grep '^const _S_' gen-sysinfo.go | \
143149
sed -e 's/^\(const \)_\(S_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}

0 commit comments

Comments
 (0)