search for: guestfs_pop_error_handler

Displaying 20 results from an estimated 114 matches for "guestfs_pop_error_handler".

2014 Dec 09
0
[PATCH] inspection: Not an installer if there are multiple partitions (RHBZ#1171666).
...s) debug (g, "augeas pathexpr = %s", ret); return ret; } - -static int -is_partition (guestfs_h *g, const char *partition) -{ - CLEANUP_FREE char *device = NULL; - - guestfs_push_error_handler (g, NULL, NULL); - - if ((device = guestfs_part_to_dev (g, partition)) == NULL) { - guestfs_pop_error_handler (g); - return 0; - } - - if (guestfs_device_index (g, device) == -1) { - guestfs_pop_error_handler (g); - return 0; - } - - guestfs_pop_error_handler (g); - - return 1; -} diff --git a/src/inspect-fs.c b/src/inspect-fs.c index e9cc2e9..7b116db 100644 --- a/src/inspect-fs.c +++ b/src/i...
2020 Feb 26
1
[PATCH] filesystems: fix size reporting for filesystems
...ik Skultety. --- cat/filesystems.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cat/filesystems.c b/cat/filesystems.c index cec3c4e47..2b95d3112 100644 --- a/cat/filesystems.c +++ b/cat/filesystems.c @@ -508,7 +508,23 @@ do_output_filesystems (void) guestfs_pop_error_handler (g); if (!device || !subvolume) { - size = guestfs_blockdev_getsize64 (g, fses[i]); + /* Try mounting and stating the device. This might reasonably + * fail, so don't show errors. + */ + guestfs_push_error_handler (g, NULL, NULL); + + if (gu...
2013 Jan 24
2
[PATCH 1/2] lib: Add CLEANUP_FREE macro which automatically calls 'free' when leaving scope.
...@ void guestfs_close (guestfs_h *g) { struct qemu_param *qp, *qp_next; +#ifndef HAVE_ATTRIBUTE_CLEANUP + struct deferred_free *dfp, *dfp_next; +#endif guestfs_h **gg; if (g->state == NO_HANDLE) { @@ -324,6 +327,18 @@ guestfs_close (guestfs_h *g) while (g->error_cb_stack) guestfs_pop_error_handler (g); +#ifndef HAVE_ATTRIBUTE_CLEANUP + /* For compilers that don't support __attribute__((cleanup(...))), + * free any temporary data that we allocated in CLEANUP_* macros + * here. + */ + for (dfp = g->deferred_frees; dfp; dfp = dfp_next) { + dfp->freefn (&dfp->data);...
2017 Jul 21
0
[PATCH v3 REPOST 5/5] threads: Add a test.
...f (!p || STRNEQ (p, "test")) { + fprintf (stderr, "invalid return from guestfs_get_hv\n"); + pthread_exit ((void *)-1); + } + free (p); + + guestfs_push_error_handler (g, NULL, NULL); + guestfs_set_hv (g, "test"); + p = guestfs_get_hv (g); + guestfs_pop_error_handler (g); + if (!p || STRNEQ (p, "test")) { + fprintf (stderr, "invalid return from guestfs_get_hv\n"); + pthread_exit ((void *)-1); + } + free (p); + + guestfs_push_error_handler (g, NULL, NULL); + guestfs_set_program (g, NULL); /* deliberately cause an erro...
2015 Jun 16
5
[PATCH threads v2 0/5] Add support for thread-safe handle.
Previous discussion here: https://www.redhat.com/archives/libguestfs/2015-June/thread.html#00048 v2: - Use a cleanup handler to release the lock. - Rebase to upstream. Note I have not fixed the problem(s) with error handling (patch 3).
2017 Jun 27
0
[PATCH v3 3/5] threads: Use thread-local storage for errors.
We permit the following constructs in libguestfs code: if (guestfs_some_call (g) == -1) { fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); } and: guestfs_push_error_handler (g, NULL, NULL); guestfs_some_call (g); guestfs_pop_error_handler (g); Neither of these would be safe if we allowed the handle to be used from threads concurrently, since the error string or error handler could be changed by another thread. Solve this in approximately the same way that libvirt does: by making the error, current error handler, and stack of error...
2020 Sep 07
5
[PATCH common v2 0/4] Windows BitLocker support.
For links to the original patch series, see: https://bugzilla.redhat.com/show_bug.cgi?id=1808977#c8 The original feedback was that ignoring errors from guestfs_luks_uuid would ignore legitimate errors from non-BitLocker disks, so I have modified this series so that errors are only ignored in the BitLocker case. As noted in the 4th patch there is no actual error in the BitLocker case, cryptsetup
2020 Mar 30
6
[PATCH common 0/4] options: Support Windows BitLocker (RHBZ#1808977).
Support transparent decryption/inspection of Windows guests encrypted with BitLocker encryption. This won't make much sense without the associated libguestfs patches which I will post momentarily. (Submodules, ho hum) Rich.
2015 Jun 06
0
[PATCH 3/5] threads: Use thread-local storage for errors.
We permit the following constructs in libguestfs code: if (guestfs_some_call (g) == -1) { fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); } and: guestfs_push_error_handler (g, NULL, NULL); guestfs_some_call (g); guestfs_pop_error_handler (g); Neither of these would be safe if we allowed the handle to be used from threads concurrently, since the error string or error handler could be changed by another thread. Solve this in approximately the same way that libvirt does: by making the error, current error handler, and stack of error...
2016 Jun 08
1
[PATCH] filesystems: don't try to get the size of btrfs subvolume
...rno (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_FAILURE); + } } if (is_md (fses[i])) -- 2.6.6
2016 Jun 15
1
[PATCH v2] filesystems: don't try to get the size of btrfs subvolume
...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 == -1) + exit (EXIT_FAILURE); + } } if (is_md (fses[i])) -- 2.6.6
2015 Jun 06
7
[PATCH 0/5] Add support for thread-safe handle.
This patch isn't ready to go upstream. In fact, I think we might do a quick 1.30 release soon, and save this patch, and also the extensive changes proposed for the test suite[1], to after 1.30. Currently it is not safe to use the same handle from multiple threads, unless you implement your own mutexes. See: http://libguestfs.org/guestfs.3.html#multiple-handles-and-multiple-threads These
2017 Jun 27
9
[PATCH v3 0/5] threads: Add support for thread-safe handle.
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html I have rebased and tidied up the patches, fixing a few spelling mistakes, but they are broadly the same as before. I also ran all the tests, which pass. As with the previous versions, this makes a change to the API, where you
2020 Sep 17
1
Re: [PATCH v2 7/7] lib/canonical-name.c: Hide errors.
...*device) > } > else if (STRPREFIX (device, "/dev/mapper/") || > STRPREFIX (device, "/dev/dm-")) { > - /* XXX hide errors */ > + guestfs_push_error_handler (g, NULL, NULL); > ret = guestfs_lvm_canonical_lv_name (g, device); > + guestfs_pop_error_handler (g); Instead of ignoring all the errors from lvm_canonical_lv_name, isn't there a way to avoid getting into this situation in the first place? Right now it is not ignored, so if anything fails we can immediately notice it, which won't happen anymore with the proposed change. -- Pino Tosc...
2017 Jul 10
2
Re: [PATCH v3 3/5] threads: Use thread-local storage for errors.
...t the following constructs in libguestfs code: > > if (guestfs_some_call (g) == -1) { > fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); > } > > and: > > guestfs_push_error_handler (g, NULL, NULL); > guestfs_some_call (g); > guestfs_pop_error_handler (g); > > Neither of these would be safe if we allowed the handle to be used > from threads concurrently, since the error string or error handler > could be changed by another thread. > > Solve this in approximately the same way that libvirt does: by making > the error, curren...
2016 Jan 26
1
[PATCH] inspect: resolve symlinks when detecting architecture
...arch = guestfs_file_architecture (g, binaries[i]); + resolved = guestfs_realpath (g, binaries[i]); + /* If is_file above succeeded realpath should too, but better + * be safe than sorry. + */ + if (resolved) + arch = guestfs_file_architecture (g, resolved); guestfs_pop_error_handler (g); if (arch) { -- 2.5.0
2015 Jun 11
2
Re: [PATCH 3/5] threads: Use thread-local storage for errors.
...t the following constructs in libguestfs code: > > if (guestfs_some_call (g) == -1) { > fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); > } > > and: > > guestfs_push_error_handler (g, NULL, NULL); > guestfs_some_call (g); > guestfs_pop_error_handler (g); > > Neither of these would be safe if we allowed the handle to be used > from threads concurrently, since the error string or error handler > could be changed by another thread. > > Solve this in approximately the same way that libvirt does: by making > the error, curren...
2016 Oct 11
1
Re: [PATCH v3 1/2] New tool: virt-tail.
...file within a guest, rather like > the regular 'tail -f' command. For example: > > virt-tail -d guest /var/log/messages > --- Mostly LGTM, just 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...
2018 Oct 04
0
[PATCH v2 3/4] inspector: Use libxml writer macros.
...D_CAST str)); - free (str); - str = guestfs_inspect_get_windows_current_control_set (g, root); - if (str) - XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "windows_current_control_set", - BAD_CAST str)); - free (str); - guestfs_pop_error_handler (g); - - str = guestfs_inspect_get_hostname (g, root); - if (!str) exit (EXIT_FAILURE); - if (STRNEQ (str, "unknown")) - XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "hostname", - BAD_CAST str)); - free (str); - - str = guestfs_inspect_get_osinfo (g...
2015 Sep 10
1
[PATCH] launch: libvirt: Better error when bridge / virbr0 doesn't exist (RHBZ#1262127).
..._h *g); +static int check_bridge_exists (guestfs_h *g, const char *brname); #if HAVE_LIBSELINUX static void selinux_warning (guestfs_h *g, const char *func, const char *selinux_op, const char *data); @@ -393,6 +394,9 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri) } guestfs_pop_error_handler (g); + if (g->enable_network && check_bridge_exists (g, data->network_bridge) == -1) + goto cleanup; + /* Locate and/or build the appliance. */ TRACE0 (launch_build_libvirt_appliance_start); @@ -1988,6 +1992,49 @@ is_blk (const char *path) return S_ISBLK (statbuf.st_m...