projects
/
oweals
/
opkg-lede.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libopkg: remove unused progress parameters from opkg_download()
[oweals/opkg-lede.git]
/
libopkg
/
opkg_cmd.c
diff --git
a/libopkg/opkg_cmd.c
b/libopkg/opkg_cmd.c
index a97255393650621e23799142ff9722e69672ebd4..7d5bd04a8d45f06c7f3a9ee064eb24581249c755 100644
(file)
--- a/
libopkg/opkg_cmd.c
+++ b/
libopkg/opkg_cmd.c
@@
-130,7
+130,7
@@
static int opkg_update_cmd(int argc, char **argv)
sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
pkglist_dl_error = 0;
sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
pkglist_dl_error = 0;
- if (opkg_download(url, list_file_name,
NULL, NULL,
0)) {
+ if (opkg_download(url, list_file_name, 0)) {
failures++;
pkglist_dl_error = 1;
opkg_msg(NOTICE,
failures++;
pkglist_dl_error = 1;
opkg_msg(NOTICE,
@@
-160,7
+160,7
@@
static int opkg_update_cmd(int argc, char **argv)
sprintf_alloc(&tmp_file_name, "%s/%s.sig", lists_dir,
src->name);
sprintf_alloc(&tmp_file_name, "%s/%s.sig", lists_dir,
src->name);
- err = opkg_download(url, tmp_file_name,
NULL, NULL,
0);
+ err = opkg_download(url, tmp_file_name, 0);
if (err) {
failures++;
opkg_msg(NOTICE,
if (err) {
failures++;
opkg_msg(NOTICE,
@@
-214,13
+214,19
@@
static opkg_intercept_t opkg_prep_intercepts(void)
ctx = xcalloc(1, sizeof(*ctx));
ctx->oldpath = xstrdup(getenv("PATH"));
ctx = xcalloc(1, sizeof(*ctx));
ctx->oldpath = xstrdup(getenv("PATH"));
- sprintf_alloc(&newpath, "%s/opkg/intercept:%s", DATADIR, ctx->oldpath);
+
+ sprintf_alloc(&newpath, "%s/opkg/intercept:%s", DATADIR,
+ ctx->oldpath ? ctx->oldpath : PATH_SPEC);
+
sprintf_alloc(&ctx->statedir, "%s/opkg-intercept-XXXXXX",
sprintf_alloc(&ctx->statedir, "%s/opkg-intercept-XXXXXX",
- conf->tmp_dir);
+ conf->tmp_dir);
if (mkdtemp(ctx->statedir) == NULL) {
opkg_perror(ERROR, "Failed to make temp dir %s", ctx->statedir);
if (mkdtemp(ctx->statedir) == NULL) {
opkg_perror(ERROR, "Failed to make temp dir %s", ctx->statedir);
- free(ctx->oldpath);
+
+ if (ctx->oldpath)
+ free(ctx->oldpath);
+
free(ctx->statedir);
free(newpath);
free(ctx);
free(ctx->statedir);
free(newpath);
free(ctx);
@@
-239,8
+245,13
@@
static int opkg_finalize_intercepts(opkg_intercept_t ctx)
DIR *dir;
int err = 0;
DIR *dir;
int err = 0;
- setenv("PATH", ctx->oldpath, 1);
- free(ctx->oldpath);
+ if (ctx->oldpath) {
+ setenv("PATH", ctx->oldpath, 1);
+ free(ctx->oldpath);
+ }
+ else {
+ unsetenv("PATH");
+ }
dir = opendir(ctx->statedir);
if (dir) {
dir = opendir(ctx->statedir);
if (dir) {
@@
-254,7
+265,7
@@
static int opkg_finalize_intercepts(opkg_intercept_t ctx)
sprintf_alloc(&path, "%s/%s", ctx->statedir,
de->d_name);
if (access(path, X_OK) == 0) {
sprintf_alloc(&path, "%s/%s", ctx->statedir,
de->d_name);
if (access(path, X_OK) == 0) {
- const char *argv[] = { "sh", "-c", path, NULL };
+ const char *argv[] = { "
/bin/
sh", "-c", path, NULL };
xsystem(argv);
}
free(path);
xsystem(argv);
}
free(path);
@@
-1033,7
+1044,7
@@
opkg_what_depends_conflicts_cmd(enum depend_type what_field_type, int recursive,
deps = pkg_get_ptr(pkg, (what_field_type == CONFLICTS) ? PKG_CONFLICTS : PKG_DEPENDS);
deps = pkg_get_ptr(pkg, (what_field_type == CONFLICTS) ? PKG_CONFLICTS : PKG_DEPENDS);
- for (cdep = deps; cdep->type; cdep++) {
+ for (cdep = deps; cdep
&& cdep
->type; cdep++) {
if (what_field_type != cdep->type)
continue;
if (what_field_type != cdep->type)
continue;
@@
-1136,7
+1147,7
@@
opkg_what_provides_replaces_cmd(enum what_field_type what_field_type, int argc,
abpkgs = pkg_get_ptr(pkg, (what_field_type == WHATPROVIDES) ? PKG_PROVIDES : PKG_REPLACES);
while (abpkgs && *abpkgs) {
abpkgs = pkg_get_ptr(pkg, (what_field_type == WHATPROVIDES) ? PKG_PROVIDES : PKG_REPLACES);
while (abpkgs && *abpkgs) {
- apkg = *abpkgs;
+ apkg = *abpkgs
++
;
if (fnmatch(target, apkg->name, conf->nocase))
continue;
if (fnmatch(target, apkg->name, conf->nocase))
continue;
@@
-1148,7
+1159,6
@@
opkg_what_provides_replaces_cmd(enum what_field_type what_field_type, int argc,
opkg_msg(NOTICE, "\t%s %s\n", rel_str, apkg->name);
opkg_message(NOTICE, "\n");
opkg_msg(NOTICE, "\t%s %s\n", rel_str, apkg->name);
opkg_message(NOTICE, "\n");
- abpkgs++;
}
}
}
}
}
}