s3:net registry import: improve regdb_open/close layering
authorMichael Adam <obnox@samba.org>
Tue, 26 Jun 2012 13:02:41 +0000 (15:02 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 26 Jun 2012 17:57:19 +0000 (19:57 +0200)
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

source3/utils/net_registry.c

index 763ed0d918175e0d85a9be9f81e36ffb97b67707..5d93a71390798bb9dc6f0ec235eee318815c465d 100644 (file)
@@ -1276,14 +1276,15 @@ static int net_registry_import(struct net_context *c, int argc,
                d_printf("%s\n%s",
                         _("Example:"),
                         _("net registry import file.reg enc=CP1252\n"));
-               goto done;
+               return -1;
        }
 
        werr = regdb_open();
        if (!W_ERROR_IS_OK(werr)) {
                d_printf("Failed to open regdb: %s\n", win_errstr(werr));
-               goto done;
+               return -1;
        }
+
        werr = regdb_transaction_start();
        if (!W_ERROR_IS_OK(werr)) {
                d_printf("Failed to start transaction on regdb: %s\n",
@@ -1306,8 +1307,8 @@ static int net_registry_import(struct net_context *c, int argc,
                }
        }
 
-       regdb_close();
 done:
+       regdb_close();
        return ret;
 }
 /**@}*/