Displaying 20 results from an estimated 63 matches for "guestfs_int_program_name".
2016 Sep 08
4
[PATCH 0/3] Use gnulib's getprogname
Hi,
this series update libguestfs to a recent gnulib version, so that we
can use its new getprogname module, and solve altogether one of the
porting issues (the need for 'program_name' by the error module of
gnulib), and have a single way to get the name of the current program.
A number of changes in tools mostly, although mechanical.
Thanks,
Pino Toscano (3):
Update gnulib to latest
2015 Oct 05
3
[PATCH 1/2] Change 'fprintf (stdout,...)' -> printf.
...16 files changed, 373 insertions(+), 389 deletions(-)
diff --git a/align/scan.c b/align/scan.c
index 188450c..ef92f42 100644
--- a/align/scan.c
+++ b/align/scan.c
@@ -73,24 +73,23 @@ usage (int status)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
guestfs_int_program_name);
else {
- fprintf (stdout,
- _("%s: check alignment of virtual machine partitions\n"
- "Copyright (C) 2011 Red Hat Inc.\n"
- "Usage:\n"
- " %s [--options] -d domname\n"
- " %s [--options]...
2015 Oct 05
0
[PATCH 2/2] Fix whitespace.
...+ b/align/scan.c
@@ -90,8 +90,8 @@ usage (int status)
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
- guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name,
- guestfs_int_program_name);
+ guestfs_int_program_name, guestfs_int_program_name,
+ guestfs_int_program_name, guestfs_int_program_name);
}
exit (status);
}
@@ -151,7 +151,8 @@ main (int argc, char *argv[]...
2016 May 05
1
[PATCH] tools: improve reporting for option errors (RHBZ#1316041)
.../cat/cat.c
@@ -224,8 +224,11 @@ main (int argc, char *argv[])
CHECK_OPTION_format_consumed;
/* User must have specified some drives. */
- if (drvs == NULL)
+ if (drvs == NULL) {
+ fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
+ guestfs_int_program_name);
usage (EXIT_FAILURE);
+ }
/* Add drives, inspect and mount. */
add_drives (drvs, 'a');
diff --git a/cat/filesystems.c b/cat/filesystems.c
index 3f9d931..f1c2852 100644
--- a/cat/filesystems.c
+++ b/cat/filesystems.c
@@ -291,8 +291,13 @@ main (int argc, char *argv[])
asser...
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.
(http://stackoverflow.com/a/228797)
These large but completely mechanical patches change the illegal
identifiers to legal ones.
Rich.
2016 Apr 04
0
[PATCH 2/2] Use 'error' function for fprintf followed by exit.
Like with the previous commit, this replaces instances of:
if (something_bad) {
fprintf (stderr, "%s: error message\n", guestfs_int_program_name);
exit (EXIT_FAILURE);
}
with:
if (something_bad)
error (EXIT_FAILURE, 0, "error message");
(except in a few cases were errno was incorrectly being ignored, in
which case I have fixed that).
It's slightly more complex than the previous commit because we must be
careful...
2016 Jul 18
2
[PATCH] mllib: Getopt: fix integer parsing
...;
@@ -117,6 +119,26 @@ do_call1 (value funv, value paramv)
CAMLreturn0;
}
+static int
+strtoint (const char *arg)
+{
+ long int num;
+
+ if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) {
+ fprintf (stderr, _("%s: '%s' is not a numeric value.\n"),
+ guestfs_int_program_name, arg);
+ show_error (EXIT_FAILURE);
+ }
+
+ if (num <= INT_MIN || num >= INT_MAX) {
+ fprintf (stderr, _("%s: %s: integer out of range\n"),
+ guestfs_int_program_name, arg);
+ show_error (EXIT_FAILURE);
+ }
+
+ return (int) num;
+}
+
value
guestfs_int_mlli...
2016 Jul 20
0
[PATCH] podcheck: Check tool --help output.
...uot; -v|--verbose Verbose messages\n"
+ " -V|--version Display version and exit\n"
+ " -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
guestfs_int_program_name, guestfs_int_program_name,
guestfs_int_program_name, guestfs_int_program_name);
diff --git a/fish/fish.c b/fish/fish.c
index e639d3d..d2cf359 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -126,6 +126,7 @@ usage (int status)
" --echo-keys Don't turn off...
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...strstr (error_str, "fusermount: entry for") != NULL) {
goto not_mounted;
}
}
@@ -205,10 +204,10 @@ main (int argc, char *argv[])
/* fusermount failed after N retries */
if (!quiet) {
fprintf (stderr, _("%s: failed to unmount %s: %s\n"),
- guestfs_int_program_name, mountpoint, error);
+ guestfs_int_program_name, mountpoint, error_str);
do_fuser (mountpoint);
}
- free (error);
+ free (error_str);
exit (2);
@@ -216,9 +215,9 @@ main (int argc, char *argv[])
not_mounted:
if (!quiet)
fprintf (stderr, _("%s: %s is not mo...
2016 Mar 02
1
[PATCH] make-fs: print error message on mkfs failure
...b/make-fs/make-fs.c
@@ -773,8 +773,8 @@ do_make_fs (const char *input, const char *output_str)
if (r == -1) {
/* Provide more guidance in the error message (RHBZ#823883). */
- fprintf (stderr, "%s: 'mkfs' (create filesystem) operation failed.\n",
- guestfs_int_program_name);
+ fprintf (stderr, "%s: 'mkfs' (create filesystem) operation failed: %s\n",
+ guestfs_int_program_name, guestfs_last_error (g));
if (STREQ (type, "fat"))
fprintf (stderr, "Instead of 'fat', try 'vfat' (long filena...
2016 Jul 18
0
Re: [PATCH] mllib: Getopt: fix integer parsing
...so be 'long' (as in my patch).
> +static int
> +strtoint (const char *arg)
> +{
> + long int num;
> +
> + if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) {
> + fprintf (stderr, _("%s: '%s' is not a numeric value.\n"),
> + guestfs_int_program_name, arg);
> + show_error (EXIT_FAILURE);
> + }
> +
> + if (num <= INT_MIN || num >= INT_MAX) {
> + fprintf (stderr, _("%s: %s: integer out of range\n"),
> + guestfs_int_program_name, arg);
> + show_error (EXIT_FAILURE);
These bounds are not...
2016 Jul 18
4
[PATCH 1/3] mllib: Getopt: point to man page as additional help
...lib/getopt-c.c
index bf40f91..3efd5d3 100644
--- a/mllib/getopt-c.c
+++ b/mllib/getopt-c.c
@@ -69,8 +69,8 @@ cleanup_option_list (void *ptr)
static void __attribute__((noreturn))
show_error (int status)
{
- fprintf (stderr, _("Try `%s --help' for more information.\n"),
- guestfs_int_program_name);
+ fprintf (stderr, _("Try `%s --help' or consult %s(1) for more information.\n"),
+ guestfs_int_program_name, guestfs_int_program_name);
exit (status);
}
--
2.7.4
2015 Jul 21
1
[PATCH] p2v: tests: Don't fail when test machine has only a single hard disk.
...exit (EXIT_SUCCESS);
}
+ /* Some disks must have been specified for conversion. */
+ if (config->disks == NULL || guestfs_int_count_strings (config->disks) == 0) {
+ fprintf (stderr, "%s: error: no non-removable disks were discovered on this machine.\n",
+ guestfs_int_program_name);
+ fprintf (stderr, "virt-p2v looked in /sys/block and in p2v.disks on the kernel command line.\n");
+ fprintf (stderr, "This is a fatal error and virt-p2v cannot continue.\n");
+ exit (EXIT_FAILURE);
+ }
+
/* Perform the conversion in text mode. */
if (start_co...
2016 Mar 08
0
[PATCH v2 3/3] fish: fix btrfs subvolumes display in error case
.../options.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/fish/options.c b/fish/options.c
index da5015d..9222b69 100644
--- a/fish/options.c
+++ b/fish/options.c
@@ -280,7 +280,33 @@ display_mountpoints_on_failure (const char *mp_device,
guestfs_int_program_name);
for (i = 0; fses[i] != NULL; i += 2) {
- CLEANUP_FREE char *p = guestfs_canonical_device_name (g, fses[i]);
+ CLEANUP_FREE char *p = NULL;
+ CLEANUP_FREE char *device = guestfs_mountable_device(g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+ int subvolume_errno;
+
+ g...
2016 Jun 08
1
[PATCH] filesystems: don't try to get the size of btrfs subvolume
...error_handler (g, NULL, NULL);
+
+ subvolume = guestfs_mountable_subvolume (g, fses[i]);
+ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
+ fprintf (stderr,
+ _("%s: cannot determine the subvolume for %s: %s (%d)\n"),
+ guestfs_int_program_name, fses[i],
+ guestfs_last_error (g), guestfs_last_errno (g));
exit (EXIT_FAILURE);
+ }
+
+ guestfs_pop_error_handler (g);
+
+ if (!device || !subvolume) {
+ size = guestfs_blockdev_getsize64 (g, fses[i]);
+ if (size == -1)
+ exit (EXIT_FA...
2016 Mar 08
7
[PATCH v2 0/3] btrfs subvolumes display fix
Hi all,
Here is version 2 of the patch series, including the changes for Pino's remarks.
Cédric Bosdonnat (3):
configure: handle older version of ncurses
api: add mountable_device and mountable_subvolume
fish: fix btrfs subvolumes display in error case
fish/options.c | 28 ++++++++++++++++++++++++++-
generator/actions.ml | 26 +++++++++++++++++++++++++
2016 Mar 01
0
[PATCH 3/3] fish: fix btrfs subvolumes display in error case
...ad.
---
fish/options.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/fish/options.c b/fish/options.c
index da5015d..5c09bfb 100644
--- a/fish/options.c
+++ b/fish/options.c
@@ -280,7 +280,20 @@ display_mountpoints_on_failure (const char *mp_device,
guestfs_int_program_name);
for (i = 0; fses[i] != NULL; i += 2) {
- CLEANUP_FREE char *p = guestfs_canonical_device_name (g, fses[i]);
+ CLEANUP_FREE char *p = NULL;
+ CLEANUP_FREE char *device = guestfs_mountable_device(g, fses[i]);
+ CLEANUP_FREE char *volume = guestfs_mountable_subvolume(g, fses[i]);
+...
2016 Jun 15
1
[PATCH v2] filesystems: don't try to get the size of btrfs subvolume
..._error_handler (g, NULL, NULL);
+
+ subvolume = guestfs_mountable_subvolume (g, fses[i]);
+ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
+ fprintf (stderr,
+ _("%s: cannot determine the subvolume for %s: %s: %s\n"),
+ guestfs_int_program_name, fses[i],
+ guestfs_last_error (g),
+ strerror (guestfs_last_errno (g)));
exit (EXIT_FAILURE);
+ }
+
+ guestfs_pop_error_handler (g);
+
+ if (!device || !subvolume) {
+ size = guestfs_blockdev_getsize64 (g, fses[i]);
+ if (size ==...
2016 Jul 15
0
[PATCH 1/3] mllib: Fix parsing of integers on the command line and use correct int type.
...-> unit) */
- if (sscanf (optarg, "%d", &num) != 1) {
+ if (sscanf (optarg, "%ld%n", &num, &nchars) < 1
+ || optarg[nchars] != '\0') {
fprintf (stderr, _("'%s' is not a numeric value.\n"),
guestfs_int_program_name);
show_error (EXIT_FAILURE);
@@ -284,7 +286,8 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu
break;
case 6: /* Set_int of string * int ref */
- if (sscanf (optarg, "%d", &num) != 1) {
+ if (sscanf (optarg, "%l...
2016 Jul 18
0
[PATCH v3 1/3] mllib: getopt: Further fix int parsing.
...@@ -124,13 +124,13 @@ strtoint (const char *arg)
{
long int num;
- if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) {
+ if (xstrtol (arg, NULL, 0, &num, "") != LONGINT_OK) {
fprintf (stderr, _("%s: '%s' is not a numeric value.\n"),
guestfs_int_program_name, arg);
show_error (EXIT_FAILURE);
}
- if (num <= -(2LL<<30) || num >= ((2LL<<30)-1)) {
+ if (num < -(1<<30) || num > (1<<30)-1) {
fprintf (stderr, _("%s: %s: integer out of range\n"),
guestfs_int_program_name, arg);
s...