list_file_name);
}
free(url);
-#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
+#if defined(HAVE_USIGN)
if (pkglist_dl_error == 0 && conf->check_signature) {
/* download detached signitures to verify the package lists */
/* get the url for the sig file */
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",
- conf->tmp_dir);
+ conf->tmp_dir);
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);
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) {
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);
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;
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;
opkg_msg(NOTICE, "\t%s %s\n", rel_str, apkg->name);
opkg_message(NOTICE, "\n");
- abpkgs++;
}
}
}