[pmg-devel] [PATCH api 2/3] UserConfig: remove useless eval

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Feb 9 11:08:31 CET 2018


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
best viewed with `git show -w`
 PMG/UserConfig.pm | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/PMG/UserConfig.pm b/PMG/UserConfig.pm
index 8ccb8f5..0b9a73d 100644
--- a/PMG/UserConfig.pm
+++ b/PMG/UserConfig.pm
@@ -241,19 +241,13 @@ sub write_user_conf {
 	$d->{userid} = $userid;
 
 	die "invalid userid '$userid'\n" if $userid eq 'root at pmg';
+	$verity_entry->($d);
+	$cfg->{$d->{userid}} = $d;
 
-	eval {
-	    $verity_entry->($d);
-	    $cfg->{$d->{userid}} = $d;
-
-	    if ($d->{userid} ne 'root at pam') {
-		die "role 'root' is reserved\n" if $d->{role} eq 'root';
-		die "unable to add users for realm '$d->{realm}'\n"
-		    if $d->{realm} && $d->{realm} ne 'pmg';
-	    }
-	};
-	if (my $err = $@) {
-	    die $err;
+	if ($d->{userid} ne 'root at pam') {
+	    die "role 'root' is reserved\n" if $d->{role} eq 'root';
+	    die "unable to add users for realm '$d->{realm}'\n"
+		if $d->{realm} && $d->{realm} ne 'pmg';
 	}
 
 	my $line;
-- 
2.11.0




More information about the pmg-devel mailing list