2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 05:48:07 +00:00

Exit immediately if not root.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5749 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare 2009-07-03 19:37:22 +00:00
parent 6868367764
commit 6ff7f5e25b
2 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,9 @@
lm-sensors CHANGES file lm-sensors CHANGES file
----------------------- -----------------------
SVN-HEAD
pwmconfig: Exit immediately if not root
3.1.1 (2009-06-21) 3.1.1 (2009-06-21)
isadump: Use geteuid instead of getuid so that setuid bit works isadump: Use geteuid instead of getuid so that setuid bit works
isaset: Use geteuid instead of getuid so that setuid bit works isaset: Use geteuid instead of getuid so that setuid bit works

View File

@ -42,6 +42,12 @@ then
exit 1 exit 1
fi fi
if [ "`id -u`" != "0" ]
then
echo "You need to be root to run this script."
exit 1
fi
echo "# pwmconfig revision $REVISION ($REVDATE)" echo "# pwmconfig revision $REVISION ($REVDATE)"
echo 'This program will search your sensors for pulse width modulation (pwm)' echo 'This program will search your sensors for pulse width modulation (pwm)'
echo 'controls, and test each one to see if it controls a fan on' echo 'controls, and test each one to see if it controls a fan on'
@ -258,7 +264,7 @@ do
GOODPWM="$GOODPWM $i" GOODPWM="$GOODPWM $i"
fi fi
else else
NOTROOT=1 echo "Can't write to $i, skipping."
fi fi
done done
@ -302,13 +308,6 @@ then
exit 1 exit 1
fi fi
if [ "$NOTROOT" = "1" ]
then
echo 'As you are not root, we cannot write the PWM settings.'
echo 'Please run as root to continue.'
exit 1
fi
echo 'Warning!!! This program will stop your fans, one at a time,' echo 'Warning!!! This program will stop your fans, one at a time,'
echo "for approximately $DELAY seconds each!!!" echo "for approximately $DELAY seconds each!!!"
echo 'This may cause your processor temperature to rise!!!' echo 'This may cause your processor temperature to rise!!!'