From c146c4433d10af8a46973b242d48c2aee920dff8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 27 May 2009 13:53:29 -0700 Subject: Print error message on failure to create group/user Bug 4448 --- scripts/system/vyatta_update_login.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/system') diff --git a/scripts/system/vyatta_update_login.pl b/scripts/system/vyatta_update_login.pl index d482c297..c8d0a23a 100755 --- a/scripts/system/vyatta_update_login.pl +++ b/scripts/system/vyatta_update_login.pl @@ -120,8 +120,10 @@ for my $user (@user_keys) { $cmd .= " -c \"$fname\"" if ( defined $fname ); $cmd .= " -d \"$home\"" if ( defined $home ); $cmd .= ' -G ' . join( ',', @groups ); - system("sudo $cmd $user") == 0 - or die "sudo $cmd $user failed: $?"; + system("sudo $cmd $user"); + return if ($? == 0); + my $reason = $reasons{($? >> 8)}; + die "Attempt to change user $user failed: $reason\n"; } } -- cgit v1.2.3