From c2929d087701dd36f84e8ba5e25ba060466c1c2a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 15 Aug 2018 05:10:12 +0200 Subject: libdpkg, dpkg: Use new pager spawning support Use it instead of open-coding it, or piping it via a shell invocation, which required metacharacter escaping. --- src/configure.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/configure.c b/src/configure.c index d021e2040..66019071b 100644 --- a/src/configure.c +++ b/src/configure.c @@ -198,22 +198,27 @@ show_prompt(const char *cfgfile, const char *realold, const char *realnew, static void show_diff(const char *old, const char *new) { + struct pager *pager; pid_t pid; + pager = pager_spawn(_("conffile difference visualizer"), NULL); + pid = subproc_fork(); if (!pid) { /* Child process. */ - char cmdbuf[1024]; - - sprintf(cmdbuf, DIFF " -Nu %.250s %.250s | %.250s", - str_quote_meta(old), str_quote_meta(new), - pager_get_exec()); - - command_shell(cmdbuf, _("conffile difference visualizer")); + struct command cmd; + + command_init(&cmd, DIFF, _("conffile difference visualizer")); + command_add_arg(&cmd, DIFF); + command_add_arg(&cmd, "-Nu"); + command_add_arg(&cmd, old); + command_add_arg(&cmd, new); + command_exec(&cmd); } /* Parent process. */ subproc_reap(pid, _("conffile difference visualizer"), SUBPROC_NOCHECK); + pager_reap(pager); } /** -- cgit v1.2.3