procd: fix/clean some conditions in nand.sh
[openwrt.git] / package / system / procd / files / procd.sh
index d71c3cf..be1d888 100644 (file)
@@ -18,6 +18,7 @@
 #     file: configuration files (array)
 #     netdev: bound network device (detects ifindex changes)
 #     limits: resource limits (passed to the process)
+#     user info: array with 1 values $username
 #
 #   No space separation is done for arrays/tables - use one function argument per command line argument
 #
@@ -75,7 +76,7 @@ _procd_close_service() {
 }
 
 _procd_add_array_data() {
-       while [ -n "$1" ]; do
+       while [ "$#" -gt 0 ]; do
                json_add_string "" "$1"
                shift
        done
@@ -92,7 +93,7 @@ _procd_add_table_data() {
        while [ -n "$1" ]; do
                local var="${1%%=*}"
                local val="${1#*=}"
-               [[ "$1" == "$val" ]] && val=
+               [ "$1" = "$val" ] && val=
                json_add_string "$var" "$val"
                shift
        done
@@ -139,6 +140,9 @@ _procd_set_param() {
                nice)
                        json_add_int "$type" "$1"
                ;;
+               user)
+                       json_add_string "$type" "$1"
+               ;;
        esac
 }