xref: /linux/tools/testing/selftests/safesetid/safesetid-test.sh (revision 597473720f4dc69749542bfcfed4a927a43d935e)
1*c67e8ec0SMicah Morton#!/bin/bash
2*c67e8ec0SMicah Morton
3*c67e8ec0SMicah MortonTCID="safesetid-test.sh"
4*c67e8ec0SMicah Mortonerrcode=0
5*c67e8ec0SMicah Morton
6*c67e8ec0SMicah Morton# Kselftest framework requirement - SKIP code is 4.
7*c67e8ec0SMicah Mortonksft_skip=4
8*c67e8ec0SMicah Morton
9*c67e8ec0SMicah Mortoncheck_root()
10*c67e8ec0SMicah Morton{
11*c67e8ec0SMicah Morton	uid=$(id -u)
12*c67e8ec0SMicah Morton	if [ $uid -ne 0 ]; then
13*c67e8ec0SMicah Morton		echo $TCID: must be run as root >&2
14*c67e8ec0SMicah Morton		exit $ksft_skip
15*c67e8ec0SMicah Morton	fi
16*c67e8ec0SMicah Morton}
17*c67e8ec0SMicah Morton
18*c67e8ec0SMicah Mortonmain_function()
19*c67e8ec0SMicah Morton{
20*c67e8ec0SMicah Morton  check_root
21*c67e8ec0SMicah Morton  ./safesetid-test
22*c67e8ec0SMicah Morton}
23*c67e8ec0SMicah Morton
24*c67e8ec0SMicah Mortonmain_function
25*c67e8ec0SMicah Mortonecho "$TCID: done"
26*c67e8ec0SMicah Mortonexit $errcode
27