From abc03cc413d81c734fac76bed348aecf4c3cf74c Mon Sep 17 00:00:00 2001 From: "graham.gower" Date: Tue, 10 Nov 2009 05:00:25 +0000 Subject: [PATCH] Use xsystem() to be consistent. Some minor cleanup too. git-svn-id: http://opkg.googlecode.com/svn/trunk@274 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_cmd.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index 83f4a16..f67a264 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -19,6 +19,7 @@ #include "includes.h" #include #include +#include #include "opkg_conf.h" #include "opkg_cmd.h" @@ -33,18 +34,14 @@ #include "libbb/libbb.h" #include "opkg_utils.h" #include "opkg_defines.h" - -#include - - #include "opkg_download.h" #include "opkg_install.h" #include "opkg_upgrade.h" #include "opkg_remove.h" #include "opkg_configure.h" #include "opkg_message.h" - #include "libopkg.h" +#include "xsystem.h" static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv); static int opkg_upgrade_cmd(opkg_conf_t *conf, int argc, char **argv); @@ -338,16 +335,13 @@ static int opkg_finalize_intercepts(opkg_intercept_t ctx) struct dirent *de; while (de = readdir (dir), de != NULL) { char *path; - + if (de->d_name[0] == '.') continue; sprintf_alloc (&path, "%s/%s", ctx->statedir, de->d_name); if (access (path, X_OK) == 0) { - if (system (path)) { - err = errno; - perror (de->d_name); - } + xsystem (path); } free (path); } @@ -356,7 +350,7 @@ static int opkg_finalize_intercepts(opkg_intercept_t ctx) perror (ctx->statedir); sprintf_alloc (&cmd, "rm -rf %s", ctx->statedir); - err = system (cmd); + err = xsystem (cmd); free (cmd); free (ctx->statedir); @@ -483,8 +477,10 @@ static int opkg_configure_packages(opkg_conf_t *conf, char *pkg_name) } ic = opkg_prep_intercepts (conf); - if (ic == NULL) - return -1; + if (ic == NULL) { + err = -1; + goto error; + } for(i = 0; i < all->len; i++) { pkg = all->pkgs[i]; @@ -512,6 +508,7 @@ static int opkg_configure_packages(opkg_conf_t *conf, char *pkg_name) if (r && !err) err = r; +error: pkg_vec_free(all); pkg_vec_free(ordered); pkg_vec_free(visited); -- 2.25.1