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 1bc621c..2d42d91 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 a92a2ad..0cc3da2 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 594214b..819410f 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 cc4d251..f2b5890 100644 (file)
@@ -16,7 +16,6 @@
 */
 
 #include "includes.h"
-#include <errno.h>
 
 #include "void_list.h"
 #include "libbb/libbb.h"