Displaying 8 results from an estimated 8 matches for "guestfs_parse_environ".
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
2013 Jul 17
0
Re: Redirecting libguestfs error messages
..., it sets the
* global errno. So something like this should be used:
*/
fprintf (logfp, "error: %s\n", strerror (errno));
exit (EXIT_FAILURE);
}
(2) Call guestfs_set_error_handler just after creating the handle:
guestfs_set_error_handler (g, NULL, NULL);
(3) Call guestfs_parse_environment to parse the environment. This
would have been done by guestfs_create, except you set the
NO_ENVIRONMENT flag.
if (guestfs_parse_environment (g) == -1) {
/* see below ... */
(4) For guestfs_parse_environment and all other libguestfs calls, you
should check the return codes, and handle...
2013 Jul 17
1
Re: Redirecting libguestfs error messages
...g like this should be used:
> */
> fprintf (logfp, "error: %s\n", strerror (errno));
> exit (EXIT_FAILURE);
> }
>
> (2) Call guestfs_set_error_handler just after creating the handle:
>
> guestfs_set_error_handler (g, NULL, NULL);
>
> (3) Call guestfs_parse_environment to parse the environment. This
> would have been done by guestfs_create, except you set the
> NO_ENVIRONMENT flag.
>
> if (guestfs_parse_environment (g) == -1) {
> /* see below ... */
>
> (4) For guestfs_parse_environment and all other libguestfs calls, you
> shou...
2015 May 26
6
[PATCH 0/6] Update the way that API versions are generated for the man page.
The existing mechanism was clunky, slow and used ~ 10 MB of
local disk.
Rich.
2016 Apr 04
0
[PATCH 2/2] Use 'error' function for fprintf followed by exit.
...61,12 @@ main (int argc, char *argv[])
/* Create the handle. */
g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT);
- if (g == NULL) {
- fprintf (stderr,
- _("libguestfs-test-tool: failed to create libguestfs handle\n"));
- exit (EXIT_FAILURE);
- }
- if (guestfs_parse_environment (g) == -1) {
- fprintf (stderr,
- _("libguestfs-test-tool: failed parsing environment variables.\n"
- "Check earlier messages, and the output of the 'printenv' command.\n"));
- exit (EXIT_FAILURE);
- }
+ if (g == NULL)
+ error (EX...
2017 Apr 04
1
[PATCH] Use Unicode single quotes ‘’ in place of short single quoted strings throughout.
...handle
accordingly. For example if C<LIBGUESTFS_DEBUG=1> then the
-'verbose' flag is set in the handle.
+‘verbose’ flag is set in the handle.
I<Most programs do not need to call this>. It is done implicitly
when you call C<guestfs_create>.
@@ -1464,7 +1464,7 @@ C<guestfs_parse_environment_list>." };
Parse the list of strings in the argument C<environment>
and set flags in the handle accordingly.
For example if C<LIBGUESTFS_DEBUG=1> is a string in the list,
-then the 'verbose' flag is set in the handle.
+then the ‘verbose’ flag is set in the handle....
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...v (var[i], value[j], 1);
g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT);
- if (!g) {
- perror ("guestfs_create_flags");
- exit (EXIT_FAILURE);
- }
+ if (!g)
+ error (EXIT_FAILURE, errno, "guestfs_create_flags");
if (guestfs_parse_environment (g) == -1)
exit (EXIT_FAILURE);
@@ -66,10 +66,8 @@ main (int argc, char *argv[])
/* Check that guestfs_get_attach_method returns "appliance" ... */
g = guestfs_create ();
- if (!g) {
- perror ("guestfs_create");
- exit (EXIT_FAILURE);
- }
+ if (!g)...
2017 Feb 18
8
[PATCH 0/6] generator: Split up generator/actions.ml
Split up the huge generator/actions.ml into several smaller files.
Rich.