[arch-projects] [initscripts][PATCH 4/5] arch-tmpfiles: simplify	uid/gid validation
    Dave Reisner 
    d at falconindy.com
       
    Sun Dec 25 13:27:15 EST 2011
    
    
  
getent will process numeric UIDs/GIDs for us.
Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 arch-tmpfiles |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch-tmpfiles b/arch-tmpfiles
index a5eb535..723b6b7 100755
--- a/arch-tmpfiles
+++ b/arch-tmpfiles
@@ -25,12 +25,12 @@ checkparams() {
 	fi
 
 	# uid must be numeric or a valid user name
-	if [[ $uid && $uid != +([[:digit:]]) ]] && ! getent passwd "$uid" >/dev/null; then
+	if [[ $uid ]] && ! getent passwd "$uid" >/dev/null; then
 		return 1
 	fi
 
 	# gid must be numeric or a valid group name
-	if [[ $gid && $gid != +([[:digit:]]) ]] && ! getent group "$gid" >/dev/null; then
+	if [[ $gid ]] && ! getent group "$gid" >/dev/null; then
 		return 1
 	fi
 
-- 
1.7.8.1
    
    
More information about the arch-projects
mailing list