led_ctrl: fix check on sysfs LED directory
authorSimon Guinot <simon@sequanux.org>
Mon, 8 Nov 2010 11:06:59 +0000 (12:06 +0100)
committerSimon Guinot <simon@sequanux.org>
Mon, 8 Nov 2010 12:56:42 +0000 (13:56 +0100)
led_ctrl/led_ctrl

index d464ae7..52a39ef 100755 (executable)
@@ -197,7 +197,8 @@ if [ ! -f $CONFILE ]; then
        echo "no configuration file: $CONFILE"
        log_and_die "$(usage)"
 fi
-[ -f $SYSPATH ] || log_and_die "no sysfs LED directory: $SYSPATH"
+[ -n "$(ls -A $SYSPATH 2>/dev/null)" ] || \
+       log_and_die "missing or empty sysfs LED directory: $SYSPATH"
 
 if [ -n "$MODE" ]; then
        set_led_mode $MODE