From bd1c5142701e7cdd2176a951feabdf852f3ead57 Mon Sep 17 00:00:00 2001 From: "graham.gower" Date: Fri, 27 Nov 2009 04:09:15 +0000 Subject: [PATCH] Fix some errno abuse. git-svn-id: http://opkg.googlecode.com/svn/trunk@393 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/hash_table.c | 1 - libopkg/opkg_download.c | 13 ++++--------- libopkg/opkg_install.c | 4 ++-- libopkg/void_list.c | 1 - 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/libopkg/hash_table.c b/libopkg/hash_table.c index 1bc621c..2d42d91 100644 --- a/libopkg/hash_table.c +++ b/libopkg/hash_table.c @@ -15,7 +15,6 @@ General Public License for more details. */ -#include #include #include #include diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index a92a2ad..0cc3da2 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -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, diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 594214b..819410f 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -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); diff --git a/libopkg/void_list.c b/libopkg/void_list.c index cc4d251..f2b5890 100644 --- a/libopkg/void_list.c +++ b/libopkg/void_list.c @@ -16,7 +16,6 @@ */ #include "includes.h" -#include #include "void_list.h" #include "libbb/libbb.h" -- 2.25.1