Displaying 20 results from an estimated 89 matches for "guestfs_last_errno".
2020 Oct 09
2
Re: [PATCH v3 8/8] lib/canonical-name.c: Hide EINVAL error from underlying API call.
...ib/canonical-name.c
> +++ b/lib/canonical-name.c
> @@ -53,8 +53,16 @@ guestfs_impl_canonical_device_name (guestfs_h *g, const char *device)
> * BitLocker-encrypted volume, so simply return the original
> * name in that case.
> */
> - if (ret == NULL && guestfs_last_errno (g) == EINVAL)
> - ret = safe_strdup (g, device);
> + if (ret == NULL) {
> + if (guestfs_last_errno (g) == EINVAL)
> + ret = safe_strdup (g, device);
> + else
> + /* Make sure the original error gets pushed through the
> + * error handler...
2016 Jun 08
1
[PATCH] filesystems: don't try to get the size of btrfs subvolume
...);
- if (size == -1)
+ CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+
+ guestfs_push_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);
+ }
+
+ gue...
2011 Mar 15
0
[PATCH] perl: Binding and test for guestfs_last_errno (RHBZ#672491).
...en guests.
http://et.redhat.com/~rjones/virt-p2v
-------------- next part --------------
>From 883390fb2e8cdaf81223eb41c87f245571e3d63d Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones at redhat.com>
Date: Tue, 15 Mar 2011 16:46:00 +0000
Subject: [PATCH] perl: Binding and test for guestfs_last_errno (RHBZ#672491).
---
generator/generator_perl.ml | 34 +++++++++++++++++++
perl/t/810-mkdir-eexist.t | 76 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 0 deletions(-)
create mode 100644 perl/t/810-mkdir-eexist.t
diff --git a/generator/generator_perl.ml b/g...
2020 Oct 09
3
Re: [PATCH v3 8/8] lib/canonical-name.c: Hide EINVAL error from underlying API call.
...me (g, device);
>- if (ret == NULL)
>+ guestfs_pop_error_handler (g);
>+ /* EINVAL is expected if the device is somelike a LUKS- or
>+ * BitLocker-encrypted volume, so simply return the original
>+ * name in that case.
>+ */
>+ if (ret == NULL && guestfs_last_errno (g) == EINVAL)
> ret = safe_strdup (g, device);
> }
> else
>--
>2.27.0
>
>_______________________________________________
>Libguestfs mailing list
>Libguestfs@redhat.com
>https://www.redhat.com/mailman/listinfo/libguestfs
2016 Jun 15
1
[PATCH v2] filesystems: don't try to get the size of btrfs subvolume
...);
- if (size == -1)
+ CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+
+ guestfs_push_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_FAIL...
2020 Oct 09
0
Re: [PATCH v3 8/8] lib/canonical-name.c: Hide EINVAL error from underlying API call.
...18b4..ae4def692 100644
--- a/lib/canonical-name.c
+++ b/lib/canonical-name.c
@@ -53,8 +53,16 @@ guestfs_impl_canonical_device_name (guestfs_h *g, const char *device)
* BitLocker-encrypted volume, so simply return the original
* name in that case.
*/
- if (ret == NULL && guestfs_last_errno (g) == EINVAL)
- ret = safe_strdup (g, device);
+ if (ret == NULL) {
+ if (guestfs_last_errno (g) == EINVAL)
+ ret = safe_strdup (g, device);
+ else
+ /* Make sure the original error gets pushed through the
+ * error handlers.
+ */
+ guestfs_in...
2020 Oct 09
0
Re: [PATCH v3 8/8] lib/canonical-name.c: Hide EINVAL error from underlying API call.
...+++ b/lib/canonical-name.c
> > @@ -53,8 +53,16 @@ guestfs_impl_canonical_device_name (guestfs_h *g, const char *device)
> > * BitLocker-encrypted volume, so simply return the original
> > * name in that case.
> > */
> > - if (ret == NULL && guestfs_last_errno (g) == EINVAL)
> > - ret = safe_strdup (g, device);
> > + if (ret == NULL) {
> > + if (guestfs_last_errno (g) == EINVAL)
> > + ret = safe_strdup (g, device);
> > + else
> > + /* Make sure the original error gets pushed through the...
2016 Mar 01
2
Re: [PATCH 3/3] fish: fix btrfs subvolumes display in error case
...sued to the
error handler set: you need to push a temporary null error handler to
avoid that:
CLEANUP_FREE char *subvolume = NULL;
int subvolume_errno;
...
guestfs_push_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);
> +...
2016 Mar 01
6
[PATCH 0/3] btrfs subvolumes display fix
Hey there!
Here are a few patches to fix unrelated things: one fixes the configure for older
ncurses releases having no pkg-config files. The other two are fixing what Richard
mentioned about guestfs subvolumes display
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
2012 Dec 14
3
inspect_os error with Win7 image
...ndle
This is the process flow:
g = guestfs_create ();
guestfs_add_drive_opts (g, diskFile,GUESTFS_ADD_DRIVE_OPTS_FORMAT,
"raw",-1);
guestfs_launch (g)
char **roots = guestfs_inspect_os (g);
guestfs_inspect_os returns NULL, guestfs_last_error(g) returns message above.
And guestfs_last_errno(g) returns 0.
However this same code works fine with a Server2008 image and an XP image.
I copied the verbose output to pastebin: http://pastebin.com/U9Jb6JwH
Suggestions?
2016 Mar 08
0
[PATCH v2 3/3] fish: fix btrfs subvolumes display in error case
...*p = NULL;
+ CLEANUP_FREE char *device = guestfs_mountable_device(g, fses[i]);
+ CLEANUP_FREE char *subvolume = NULL;
+ int subvolume_errno;
+
+ guestfs_push_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));
+ }
+
+ guestfs_pop_error_handler (g);
+
+ /* Refo...
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 Oct 11
1
Re: [PATCH v3 1/2] New tool: virt-tail.
...a few notes.
> + guestfs_push_error_handler (g, NULL, NULL);
> + stat = guestfs_statns (g, filename);
> + guestfs_pop_error_handler (g);
> + if (stat == NULL) {
> + /* There's an error. Treat ENOENT as if the file was empty size. */
> + if (guestfs_last_errno (g) == ENOENT) {
> + time (&t);
> + file[i].mtime = t;
> + file[i].size = 0;
I'd set size as -1, otherwise this is considering the file as existing.
If virt-tail (wants to) behaves like `tail -f`, I'd:
- print an error/message line (not fatal) to war...
2016 Jan 27
2
[PATCH 1/2] generator: add TestRunOrUnsupported test type
...for %s (%d) */\n" name i;
+ let seq, last = get_seq_last seq in
+ List.iter (generate_test_command_call test_name) seq;
+ generate_test_command_call test_name ~expect_error:true ~do_return:false ~ret:"ret" last;
+ pr " if (ret == -1) {\n";
+ pr " if (guestfs_last_errno (g) == ENOTSUP) {\n";
+ pr " skipped (\"%s\", \"last command %%s returned ENOTSUP\", \"%s\");\n"
+ test_name (List.hd last);
+ pr " return 0;\n";
+ pr " }\n";
+ pr " fprintf (stderr, \"%%s: t...
2013 Jul 17
2
Redirecting libguestfs error messages
Hi,
When I register a callback for events with this function call:
eh = guestfs_set_event_callback(g, message_callback, GUESTFS_EVENT_ALL, 0,
dev);
Shouldnt it capture and redirect messages like this to message_callback():
"libguestfs: error: lstat: /.Trash: No such file or directory"
I still get them in stderr ..
Thanks,
Or
2016 Dec 07
3
[PATCH v2 0/2] Improve inspection of /usr filesystems
Hi,
this patch series improves the way /usr filesystems are handled: tag
them appropriately, so later on we can find them and merge results they
contain directly back for the root filesystem.
Changes in v2:
- removed patches #1 and #2, already pushed
- drop patch #3, no more needed
- replace patch #4 with a better suggestion from Rich
- change if into assert in patch #5
Thanks,
Pino Toscano
2016 Mar 08
5
[PATCH v3 0/3] btrfs subvolumes display fix
Hi there,
Latest and greatest version including all new remarks from both Pino and Rich.
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 +++++++++++++++++++++++++
m4/guestfs_libraries.m4
2016 Mar 01
0
[PATCH 3/3] fish: fix btrfs subvolumes display in error case
...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]);
+
+ /* Reformat the internal btrfsvol string into a valid mount option */
+ if (device && volume && guestfs_last_errno (g) != EINVAL) {
+ if (asprintf (&p, "%s:/:subvol=%s", device, volume) == -1) {
+ perror ("asprintf");
+ exit (EXIT_FAILURE);
+ }
+ } else {
+ p = guestfs_canonical_device_name (g, fses[i]);
+ }
+
fprintf (stderr, "%s: \t%s (%...
2020 Sep 17
0
[PATCH v3 8/8] lib/canonical-name.c: Hide EINVAL error from underlying API call.
...guestfs_lvm_canonical_lv_name (g, device);
- if (ret == NULL)
+ guestfs_pop_error_handler (g);
+ /* EINVAL is expected if the device is somelike a LUKS- or
+ * BitLocker-encrypted volume, so simply return the original
+ * name in that case.
+ */
+ if (ret == NULL && guestfs_last_errno (g) == EINVAL)
ret = safe_strdup (g, device);
}
else
--
2.27.0
2013 Jul 17
0
Re: Redirecting libguestfs error messages
..._parse_environment (g) == -1) {
/* see below ... */
(4) For guestfs_parse_environment and all other libguestfs calls, you
should check the return codes, and handle errors, like this:
if (guestfs_parse_environment (g) == -1) {
const char *errstr = guestfs_last_error (g);
int errnum = guestfs_last_errno (g);
fprintf (logfp, "error: %s", errstr);
if (errnum > 0)
fprintf (logfp, " (%s)", strerror (errnum));
fprintf (logfp, "\n");
}
It's usually helpful to put all of that in a separate utility function
or macro. Note that 'errstr' doe...