Remove code path which cannot be executed.
[oweals/opkg-lede.git] / libopkg / opkg_cmd.c
index cc8134af602668726f4fafa3931170c4c00ec1e9..9c1612b6f7b04fd095a2b306cf2e03bbdf86a0ac 100644 (file)
@@ -195,7 +195,7 @@ static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv)
      failures = 0;
 
 
-     tmp = strdup ("/tmp/opkg.XXXXXX");
+     tmp = xstrdup("/tmp/opkg.XXXXXX");
 
      if (mkdtemp (tmp) == NULL) {
         perror ("mkdtemp");
@@ -303,18 +303,11 @@ typedef struct opkg_intercept *opkg_intercept_t;
 static opkg_intercept_t opkg_prep_intercepts(opkg_conf_t *conf)
 {
     opkg_intercept_t ctx;
-    char *oldpath;
     char *newpath;
     int gen;
 
     ctx = calloc (1, sizeof (*ctx));
-    oldpath = getenv ("PATH");
-    if (oldpath) {
-        ctx->oldpath = strdup (oldpath);
-    } else {
-        ctx->oldpath = 0;
-    }
-
+    ctx->oldpath = xstrdup(getenv("PATH"));
 
     sprintf_alloc (&newpath, "%s/opkg/intercept:%s", DATADIR, ctx->oldpath);
     setenv ("PATH", newpath, 1);
@@ -345,8 +338,6 @@ static int opkg_finalize_intercepts(opkg_intercept_t ctx)
     if (ctx->oldpath) {
         setenv ("PATH", ctx->oldpath, 1);
         free (ctx->oldpath);
-    } else {
-        unsetenv("PATH"); 
     }
 
     dir = opendir (ctx->statedir);
@@ -787,7 +778,9 @@ static int opkg_info_status_cmd(opkg_conf_t *conf, int argc, char **argv, int in
               for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
                    conffile_t *cf = (conffile_t *)iter->data;
                    int modified = conffile_has_been_modified(conf, cf);
-                   opkg_message(conf, OPKG_NOTICE, "conffile=%s md5sum=%s modified=%d\n",
+                   if (cf->value)
+                       opkg_message(conf, OPKG_NOTICE,
+                               "conffile=%s md5sum=%s modified=%d\n",
                                 cf->name, cf->value, modified);
               }
          }