diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-03-17 14:13:25 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-03-17 14:13:25 -0700 |
commit | 74ae8c9cdbbd318c928e57288b60396affb9cf9a (patch) | |
tree | 644be1705d5fcfc0a9d91addc8e53f71064127b2 /lib | |
parent | c01cbaf7a051c5e5f5f674ceb93061ebc20f141d (diff) | |
download | vyatta-cfg-system-74ae8c9cdbbd318c928e57288b60396affb9cf9a.tar.gz vyatta-cfg-system-74ae8c9cdbbd318c928e57288b60396affb9cf9a.zip |
fixes commit warning when run invoked via the api--getlogin() may return an undefined value as the process is a child process
invoked indirectly via the gui (not a normal shell logged in user generated event).
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Vyatta/Login/User.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm index afc3cf53..419a882d 100755 --- a/lib/Vyatta/Login/User.pm +++ b/lib/Vyatta/Login/User.pm @@ -102,11 +102,12 @@ sub _authorized_keys { sub _delete_user { my $user = shift; + my $login = getlogin(); if ( $user eq 'root' ) { warn "Disabling root account, instead of deleting\n"; system('usermod -p ! root') == 0 or die "usermod of root failed: $?\n"; - } elsif ( getlogin() eq $user ) { + } elsif ( defined($login) && $login eq $user ) { die "Attempting to delete current user: $user\n"; } else { if (`who | grep "^$user"` ne '') { |