aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-06-12 17:09:43 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-06-12 17:11:17 +0200
commit2d6fc0f9a6a60bc96ef9c4a10e450ed6a8247435 (patch)
tree1f3edc4a4937c46cfaa3b60f958b1a90f8f0f7e7
parent32af8ddd3d63fe0936f9ae5b6ca09285bed1baff (diff)
usergen: Fix error on empty $QUOTA
When no quota is entered, printf(1) could fail because '%d' would expect at least one argument. Whereas some printf(1) implementations, such as the one by GNU coreutils, are somewhat tolerant, stricter implementations such as Busybox would (correctly) refuse this.
-rwxr-xr-xusergen2
1 files changed, 1 insertions, 1 deletions
diff --git a/usergen b/usergen
index e59b44d..eac072b 100755
--- a/usergen
+++ b/usergen
@@ -59,7 +59,7 @@ echo
echo "Quota, in MiB (leave empty for unlimited quota):" >&2
read -r QUOTA
-QUOTA="$(printf '%d' "$QUOTA")"
+QUOTA="${QUOTA:+"$(printf '%d' "$QUOTA")"}"
PWD=$(printf '%s' "$PWD" | to_hex)
SALT=$(openssl rand -hex 32)