summaryrefslogtreecommitdiffstats
path: root/daemon/ntfsclone.c
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2012-08-30 20:51:27 +0200
committerRichard W.M. Jones <rjones@redhat.com>2012-08-30 20:57:07 +0100
commit0306c98d319d189281af3c15101c8d343e400f13 (patch)
tree7781024c541a56152405582ece9c3c0ee2edc49d /daemon/ntfsclone.c
parent4aa1464d42c62e8cbff4669f01f53f0425c287e3 (diff)
downloadlibguestfs-0306c98d319d189281af3c15101c8d343e400f13.tar.gz
libguestfs-0306c98d319d189281af3c15101c8d343e400f13.tar.xz
libguestfs-0306c98d319d189281af3c15101c8d343e400f13.zip
daemon: collect list of called external commands
guestfsd calls many different tools. Keeping track of all of them is error prone. This patch introduces a new helper macro to put the command string into its own ELF section: GUESTFSD_EXT_CMD(C_variable, command_name); This syntax makes it still possible to grep for used command names. The actual usage of the collected list could be like this: objcopy -j .guestfsd_ext_cmds -O binary daemon/guestfsd /dev/stdout | tr '\0' '\n' | sort -u The resulting output will be used to tell mkinitrd which programs to copy into the initrd. Signed-off-by: Olaf Hering <olaf@aepfle.de> RWMJ: - Move str_vgchange at request of author. - Fix snprintf call in daemon/debug.c
Diffstat (limited to 'daemon/ntfsclone.c')
-rw-r--r--daemon/ntfsclone.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/daemon/ntfsclone.c b/daemon/ntfsclone.c
index 4287edbe..bf97eaf9 100644
--- a/daemon/ntfsclone.c
+++ b/daemon/ntfsclone.c
@@ -30,6 +30,8 @@
#include "actions.h"
#include "optgroups.h"
+GUESTFSD_EXT_CMD(str_ntfsclone, ntfsclone);
+
/* Read the error file. Returns a string that the caller must free. */
static char *
read_error_file (char *error_file)
@@ -80,8 +82,8 @@ do_ntfsclone_in (const char *device)
close (fd);
/* Construct the command. */
- if (asprintf_nowarn (&cmd, "ntfsclone -O %s --restore-image - 2> %s",
- device, error_file) == -1) {
+ if (asprintf_nowarn (&cmd, "%s -O %s --restore-image - 2> %s",
+ str_ntfsclone, device, error_file) == -1) {
err = errno;
r = cancel_receive ();
errno = err;
@@ -157,7 +159,8 @@ do_ntfsclone_out (const char *device,
char buf[GUESTFS_MAX_CHUNK_SIZE];
/* Construct the ntfsclone command. */
- if (asprintf (&cmd, "ntfsclone -o - --save-image%s%s%s%s%s %s",
+ if (asprintf (&cmd, "%s -o - --save-image%s%s%s%s%s %s",
+ str_ntfsclone,
(optargs_bitmask & GUESTFS_NTFSCLONE_OUT_METADATAONLY_BITMASK) && metadataonly ? " --metadata" : "",
(optargs_bitmask & GUESTFS_NTFSCLONE_OUT_RESCUE_BITMASK) && rescue ? " --rescue" : "",
(optargs_bitmask & GUESTFS_NTFSCLONE_OUT_IGNOREFSCHECK_BITMASK) && ignorefscheck ? " --ignore-fs-check" : "",