diff options
author | Guillem Jover <guillem@debian.org> | 2018-08-15 05:10:12 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2018-08-30 03:14:08 +0200 |
commit | c2929d087701dd36f84e8ba5e25ba060466c1c2a (patch) | |
tree | e3abf5cc55c4228ece239c846a90af2994b9c074 /src | |
parent | 3b8cd0ea54e2027fd7c972e3edcbbc8bb43afa52 (diff) | |
download | dpkg-c2929d087701dd36f84e8ba5e25ba060466c1c2a.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/configure.c | 19 |
1 files changed, 12 insertions, 7 deletions
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); } /** |