]> granicus.if.org Git - sysstat/commitdiff
Check for undefined UID variable in sysstat script
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 28 May 2016 08:10:04 +0000 (10:10 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 28 May 2016 08:10:04 +0000 (10:10 +0200)
In some rare cases, UID variable (which should expand to current user's
ID with bash) happens to be undefined:

$ sudo /etc/init.d/sysstat start
/etc/init.d/sysstat: 31: [: -eq: unexpected operator

This patch checks for that.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sysstat.in

index 5dfb0622c32805e3d993788d56cda857e1fe6af0..6beb71d21d422d3cd29e27c36ca115b4214e5c2d 100644 (file)
@@ -24,6 +24,7 @@
 
 RETVAL=0
 PIDFILE=/var/run/sysstat.pid
+[ -z "$UID" ] && UID=`id -u`
 
 # See how we were called.
 case "$1" in