search for: command_flag_fold_stdout_on_stderr

Displaying 20 results from an estimated 43 matches for "command_flag_fold_stdout_on_stderr".

2016 Jan 26
1
[PATCH] daemon: improve debugging for "stdout on stderr" flag
When the COMMAND_FLAG_FOLD_STDOUT_ON_STDERR flag is passed to command*(), indicate that as stdout=e in debugging message. --- daemon/command.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/command.c b/daemon/command.c index 73fce56..2423a4e 100644 --- a/daemon/command.c +++ b/daemon/command.c @@ -185,6 +18...
2012 Feb 06
2
[PATCH 1/2] Revert "daemon: Run udev_settle after pwrite-device finishes."
...pwrite_fd (fd, content, size, offset, device, 1); + return pwrite_fd (fd, content, size, offset, device); } /* This runs the 'file' command. */ diff --git a/daemon/parted.c b/daemon/parted.c index 64a7d1d..16f0843 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -34,8 +34,7 @@ * COMMAND_FLAG_FOLD_STDOUT_ON_STDERR flag. * * parted occasionally fails to do ioctl(BLKRRPART) on the device, - * probably because udev monitors all 'close' on block devices - * and runs 'blkid' which opens and examines the device. We attempt + * apparently because of some internal race in the code. We attempt...
2015 Feb 18
1
[PATCH] Fix a bug in e2fsck execution code
...ons(+), 3 deletions(-) diff --git a/daemon/ext2.c b/daemon/ext2.c index 65ddae6..8ef6d5f 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -296,9 +296,9 @@ do_e2fsck (const char *device, ADD_ARG (argv, i, device); ADD_ARG (argv, i, NULL); - r = commandvf (NULL, &err, - COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - argv); + r = commandrvf (NULL, &err, + COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + argv); /* 0 = no errors, 1 = errors corrected. * * >= 4 means uncorrected or other errors. -- 1.9.1
2015 Dec 02
3
[PATCH] daemon: improve internal commandrvf
...;bind_state); free_resolver_state (&resolver_state); diff --git a/daemon/daemon.h b/daemon/daemon.h index 7fbb2a2..af6f68c 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -128,6 +128,7 @@ extern char **empty_list (void); #define COMMAND_FLAG_FD_MASK (1024-1) #define COMMAND_FLAG_FOLD_STDOUT_ON_STDERR 1024 #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 +#define COMMAND_FLAG_DO_CHROOT 4096 extern int commandf (char **stdoutput, char **stderror, int flags, const char *name, ...) __attribute__((sentinel)); diff --git a/daemon/guestfsd.c b/daemon/gu...
2019 Apr 15
1
[PATCH] daemon: drop error message check in do_part_expand_gpt
...699,26 +699,8 @@ do_part_expand_gpt(const char *device) { CLEANUP_FREE char *err = NULL; - /* If something is broken, sgdisk may try to correct it. - * (e.g. recreate partition table and so on). - * We do not want such behavior, so dry-run at first.*/ int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - "sgdisk", "--pretend", "-e", device, NULL); - - if (r == -1) { - reply_with_error ("%s --pretend -e %s: %s", "sgdisk", device, err); - return -1; - } - if (err && strlen(err) != 0) { - /* Unexpected actions....
2015 Dec 02
0
Re: [PATCH] daemon: improve internal commandrvf
...e (&resolver_state); > diff --git a/daemon/daemon.h b/daemon/daemon.h > index 7fbb2a2..af6f68c 100644 > --- a/daemon/daemon.h > +++ b/daemon/daemon.h > @@ -128,6 +128,7 @@ extern char **empty_list (void); > #define COMMAND_FLAG_FD_MASK (1024-1) > #define COMMAND_FLAG_FOLD_STDOUT_ON_STDERR 1024 > #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 > +#define COMMAND_FLAG_DO_CHROOT 4096 > Any eason for having this decimal? The standard thing is to use hex. > extern int commandf (char **stdoutput, char **stderror, int flags, >...
2017 Mar 02
2
[PATCH] parted: add more udev_settle calls.
...rint", NULL); + + udev_settle (); + if (r == -1) { int errcode = 0; @@ -665,6 +670,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char *field, return NULL; } + udev_settle (); + CLEANUP_FREE char *err = NULL; int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, str_sgdisk, device, "-i", partnum_str, NULL); @@ -674,6 +681,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char *field, return NULL; } + udev_settle (); + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); if (lines =...
2016 Jan 18
1
[PATCH] New API: part_get_disk_guid and part_set_disk_guid.
...char *device, int partnum) reply_with_error ("strdup failed"); return NULL; } + +char * +do_part_get_disk_guid (const char *device) +{ + const char *pattern = "Disk identifier (GUID):"; + size_t i; + + CLEANUP_FREE char *err = NULL; + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, device, "-p", NULL); + if (r == -1) { + reply_with_error ("%s %s -p: %s", str_sgdisk, device, err); + return NULL; + } + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); + if (lines == NULL) { + reply_with_error ("&...
2015 Dec 01
3
[PATCHv2] New API: part_expand_gpt.
...NULL; } + +int +do_part_expand_gpt(const char *device) +{ + CLEANUP_FREE char *err = NULL; + + /* If something is broken, sgdisk may try to correct it. + * (e.g. recreate partition table and so on). + * We do not want such behavior, so dry-run at first.*/ + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, "--pretend", "-e", device, NULL); + + if (r == -1) { + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); + return -1; + } + if (err && strlen(err) != 0) { + /* Unexpected actions. */ + reply_w...
2016 Jan 26
2
[PATCH] daemon: fold xfs_admin stdout to stderr
...) diff --git a/daemon/xfs.c b/daemon/xfs.c index abc2736..7f72e6a 100644 --- a/daemon/xfs.c +++ b/daemon/xfs.c @@ -537,7 +537,7 @@ do_xfs_admin (const char *device, ADD_ARG (argv, i, device); ADD_ARG (argv, i, NULL); - r = commandv (NULL, &err, argv); + r = commandvf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, argv); if (r == -1) { reply_with_error ("%s: %s", device, err); return -1; -- 2.5.0
2016 Jun 22
1
[PATCH] ext: change e2fsck retcode processing during resize
...ice) static int if_not_mounted_run_e2fsck (const char *device) { - CLEANUP_FREE char *err = NULL; - int r, mounted; + int r = 0, mounted; mounted = is_device_mounted (device); if (mounted == -1) return -1; if (!mounted) { - r = commandf (NULL, &err, - COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - str_e2fsck, "-fy", device, NULL); - if (r == -1) { - reply_with_error ("%s", err); - return -1; - } + optargs_bitmask = GUESTFS_E2FSCK_FORCEALL_BITMASK; + r = do_e2fsck (device, 0, 1); } - return 0; + return r; } int -- 1.8.3...
2014 Nov 24
1
[PATCH] ntfsresize: Capture errors sent to stdout (RHBZ#1166618).
...c b/daemon/ntfs.c index aef45a2..762ca88 100644 --- a/daemon/ntfs.c +++ b/daemon/ntfs.c @@ -94,7 +94,7 @@ do_ntfsresize (const char *device, int64_t size, int force) ADD_ARG (argv, i, device); ADD_ARG (argv, i, NULL); - r = commandv (NULL, &err, argv); + r = commandvf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, argv); if (r == -1) { reply_with_error ("%s: %s", device, err); return -1; -- 2.1.0
2016 Jan 19
4
[PATCHv2 0/3] Get/set disk GPT GUID API and support in virt-resize.
Some OSes (e.g. Windows Server 2012 R2) fail to boot after virt-resize due to changed disk guid. To fix it, we add new APIs: part_get_disk_guid part_set_disk_guid part_set_disk_guid_random We also preserve disk GUID in virt-resize. Maxim Perevedentsev (3): New API: part_get_disk_guid and part_set_disk_guid. New API: part_set_disk_guid_random. resize: preserve GPT disk GUID.
2016 Jan 19
0
[PATCHv2 1/3] New API: part_get_disk_guid and part_set_disk_guid.
...char *device, int partnum) reply_with_error ("strdup failed"); return NULL; } + +char * +do_part_get_disk_guid (const char *device) +{ + const char *pattern = "Disk identifier (GUID):"; + size_t i; + + CLEANUP_FREE char *err = NULL; + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, device, "-p", NULL); + if (r == -1) { + reply_with_error ("%s %s -p: %s", str_sgdisk, device, err); + return NULL; + } + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); + if (lines == NULL) { + reply_with_error ("&...
2015 Nov 25
1
[PATCH] New API: part_expand_gpt.
...NULL; } + +int +do_part_expand_gpt(const char *device) +{ + CLEANUP_FREE char *err = NULL; + + /* If something is broken, sgdisk may try to correct it. + * (e.g. recreate partition table and so on). + * We do not want such behavior, so dry-run at first.*/ + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, "--pretend", "-e", device, NULL); + + if (r == -1) { + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); + return -1; + } + if (err && strlen(err) != 0) { + /* Unexpected actions. */ + reply_w...
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...en *stdoutput will return the stdout + * of the command. + * + * If stderror is not NULL, then *stderror will return the stderr + * of the command. If there is a final \n character, it is removed + * so you can use the error string directly in a call to + * reply_with_error. + * + * Flags: + * + * COMMAND_FLAG_FOLD_STDOUT_ON_STDERR: For broken external commands + * that send error messages to stdout (hello, parted) but that don't + * have any useful stdout information, use this flag to capture the + * error messages in the *stderror buffer. If using this flag, + * you should pass stdoutput as NULL because nothing could e...
2015 Dec 22
0
Re: [PATCHv2] New API: part_expand_gpt.
...(const char *device) > +{ > + CLEANUP_FREE char *err = NULL; > + > + /* If something is broken, sgdisk may try to correct it. > + * (e.g. recreate partition table and so on). > + * We do not want such behavior, so dry-run at first.*/ > + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, > + str_sgdisk, "--pretend", "-e", device, NULL); > + > + if (r == -1) { > + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); > + return -1; > + } > + if (err && strlen(err) != 0) { > +...
2016 Jan 20
1
[PATCHv2] New API: part_expand_gpt.
...rn 0; } + +int +do_part_expand_gpt(const char *device) +{ + CLEANUP_FREE char *err = NULL; + + /* If something is broken, sgdisk may try to correct it. + * (e.g. recreate partition table and so on). + * We do not want such behavior, so dry-run at first.*/ + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, "--pretend", "-e", device, NULL); + + if (r == -1) { + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); + return -1; + } + if (err && strlen(err) != 0) { + /* Unexpected actions. */ + reply_w...
2017 Jul 27
0
[PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
...ed, parted); -GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); -GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); - /* Notes: * * Parted 1.9 sends error messages to stdout, hence use of the @@ -88,7 +84,7 @@ do_part_init (const char *device, const char *parttype) udev_settle (); r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - str_parted, "-s", "--", device, "mklabel", parttype, NULL); + "parted", "-s", "--", device, "mklabel", parttype, NULL); if (r == -1) { reply_with_error ("parted: %s: %s", device,...
2017 Jul 29
5
[PATCH 1/1] New partition API: part_resize
...reply_with_error ("partition number must be >= 1"); + return -1; + } + + snprintf (partnum_str, sizeof partnum_str, "%d", partnum); + snprintf (endstr, sizeof endstr, "%" PRIi64 "s", endsect); + + udev_settle (); + + r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + "parted", "-s", "--", device, "resizepart", partnum_str, + endstr, NULL); + if (r == -1) { + reply_with_error ("parted: %s: %s:", device, err); + return -1; + } + + udev_settle(); + + return 0; +} + +int d...