Use vfork()/execvp() instead of system().
[project/opkg-lede.git] / libopkg / opkg_install.c
index 834916db997980d8a899e30b4c63a90f3b8bf415..5e8596bfea1c83c22ab5fbb2dd3e0ee26a6b1028 100644 (file)
@@ -1560,7 +1560,7 @@ static int resolve_conffiles(opkg_conf_t *conf, pkg_t *pkg)
                   if (conf->force_maintainer) {
                       opkg_message(conf, OPKG_NOTICE, "Conffile %s using maintainer's setting.\n", cf_backup);
                   } else if (conf->force_defaults
-                          || user_prefers_old_conffile(cf->name, cf_backup) ) {
+                          || user_prefers_old_conffile(root_filename, cf_backup) ) {
                       rename(cf_backup, root_filename);
                   }
               }
@@ -1610,13 +1610,8 @@ static int user_prefers_old_conffile(const char *file_name, const char *backup)
          }
 
          if (strcmp(response, "d") == 0) {
-              char *cmd;
-
-              free(response);
-              /* XXX: BUG rewrite to use exec or busybox's internal diff */
-              sprintf_alloc(&cmd, "diff -u %s %s", backup, file_name);
-              xsystem(cmd);
-              free(cmd);
+              const char *argv[] = {"diff", "-u", backup, file_name, NULL};
+              xsystem(argv);
               printf("    [Press ENTER to continue]\n");
               response = file_read_line_alloc(stdin);
               free(response);