Fix what I broke in r484. Patch from Kosmaty in issue 34. Thanks!
[oweals/opkg-lede.git] / src / opkg-cl.c
index 3bbcd42cb77a75293077d8810d119f41d3789f01..1f3a0ae878dd7e564372c01f7fd4cbd63b67c163 100644 (file)
    opkg command line frontend using libopkg
 */
 
-#include "includes.h"
+#include "config.h"
 
+#include <stdio.h>
 #include <getopt.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 #include "opkg_conf.h"
 #include "opkg_cmd.h"
@@ -260,7 +258,7 @@ usage()
 int
 main(int argc, char *argv[])
 {
-       int opts;
+       int opts, err = -1;
        char *cmd_name;
        opkg_cmd_t *cmd;
        int nocheckfordirorfile = 0;
@@ -324,15 +322,8 @@ main(int argc, char *argv[])
                usage();
        }
 
-       if (opkg_cmd_exec(cmd, argc - opts, (const char **) (argv + opts)))
-               goto err2;
+       err = opkg_cmd_exec(cmd, argc - opts, (const char **) (argv + opts));
 
-       print_error_list();
-       free_error_list();
-
-       return 0;
-
-err2:
 #ifdef HAVE_CURL
        opkg_curl_cleanup();
 #endif
@@ -343,5 +334,5 @@ err0:
        print_error_list();
        free_error_list();
 
-       return -1;
+       return err;
 }