Fix some errno abuse.
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 27 Nov 2009 04:09:15 +0000 (04:09 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 27 Nov 2009 04:09:15 +0000 (04:09 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@393 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/hash_table.c
libopkg/opkg_download.c
libopkg/opkg_install.c
libopkg/void_list.c

index 1bc621cb1dfd1d012461101d2d48a64139a5425a..2d42d911f741f4d07cb30e63024d5fe500adcaf2 100644 (file)
@@ -15,7 +15,6 @@
    General Public License for more details.
 */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index a92a2ad11d0987300a12c95566b57c30440bd46f..0cc3da2071a577e45e48df5708a7ee14f09875df 100644 (file)
@@ -88,13 +88,12 @@ int opkg_download(opkg_conf_t *conf, const char *src,
     opkg_message(conf,OPKG_NOTICE,"Downloading %s\n", src);
        
     if (str_starts_with(src, "file:")) {
-       int ret;
        const char *file_src = src + 5;
        opkg_message(conf,OPKG_INFO,"Copying %s to %s...", file_src, dest_file_name);
-       ret = file_copy(src + 5, dest_file_name);
+       err = file_copy(file_src, dest_file_name);
        opkg_message(conf,OPKG_INFO,"Done\n");
         free(src_basec);
-       return ret;
+       return err;
     }
 
     sprintf_alloc(&tmp_file_location, "%s/%s", conf->tmp_dir, src_base);
@@ -104,7 +103,7 @@ int opkg_download(opkg_conf_t *conf, const char *src,
                __FUNCTION__, tmp_file_location, strerror(errno));
        free(tmp_file_location);
         free(src_basec);
-       return errno;
+       return -1;
     }
 
     if (conf->http_proxy) {
@@ -181,11 +180,7 @@ int opkg_download(opkg_conf_t *conf, const char *src,
     free(tmp_file_location);
     free(src_basec);
 
-    if (err) {
-       return err;
-    }
-
-    return 0;
+    return err;
 }
 
 static int opkg_download_cache(opkg_conf_t *conf, const char *src,
index 594214bc8adfe6575fe8b6eb6ba8afd807ccdee9..819410fbf51d12cee5d91ec564441ecfadf35b0b 100644 (file)
@@ -236,7 +236,7 @@ unpack_pkg_control_files(opkg_conf_t *conf, pkg_t *pkg)
          opkg_message(conf, OPKG_ERROR,
                       "%s: Failed to create temporary directory '%s': %s\n",
                       __FUNCTION__, pkg->tmp_unpack_dir, strerror(errno));
-         return errno;
+         return -1;
      }
 
      err = pkg_extract_control_files_to_dir(pkg, pkg->tmp_unpack_dir);
@@ -265,7 +265,7 @@ unpack_pkg_control_files(opkg_conf_t *conf, pkg_t *pkg)
          fprintf(stderr, "%s: failed to open %s: %s\n",
                  __FUNCTION__, conffiles_file_name, strerror(errno));
          free(conffiles_file_name);
-         return errno;
+         return -1;
      }
      free(conffiles_file_name);
 
index cc4d25142ac2a77ce65c57bcf69908877e44e931..f2b589054296d276fd82812e406d518999830c01 100644 (file)
@@ -16,7 +16,6 @@
 */
 
 #include "includes.h"
-#include <errno.h>
 
 #include "void_list.h"
 #include "libbb/libbb.h"