Displaying 20 results from an estimated 866 matches for "exit_failure".
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
Wherever we had code which did:
if (something_bad) {
perror (...);
exit (EXIT_FAILURE);
}
replace this with use of the error(3) function:
if (something_bad)
error (EXIT_FAILURE, errno, ...);
The error(3) function is supplied by glibc, or by gnulib on platforms
which don't have it, and is much more flexible than perror(3). Since
we already use error(3), there seems to...
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 to:
- Remove the progr...
2009 Nov 20
1
fix new failures from latest-from-gnulib syntax-check
There's a new syntax check rule from gnulib.
It requires that you write e.g., exit (EXIT_SUCCESS), not exit (0).
And the same for 1/EXIT_FAILURE and any other constants.
There were a lot of violations, including a few false positives,
so I started with the exemptions (see the .x-sc file below).
Then I converted the vast majority automatically, with this:
maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exit
Convert all us...
2018 Apr 05
2
[nbdkit PATCH] tests: Skip guestfs tests on CentOS 6
...streaming.c | 5 +++++
tests/test-xz.c | 5 +++++
16 files changed, 82 insertions(+)
diff --git a/tests/test-connect.c b/tests/test-connect.c
index 32ba79a..06c6163 100644
--- a/tests/test-connect.c
+++ b/tests/test-connect.c
@@ -62,6 +62,10 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
+#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL
+ printf ("libguestfs too old to support nbd disk, skipping\n");
+ exit (77);
+#else
r = guestfs_add_drive_opts (g, "",
GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
GUESTFS...
2012 Aug 06
1
[PATCH V2] virt-diff: add new virt-diff tool
...d decrypt them, then rescan for VGs. This only works
+ * for Fedora whole-disk encryption. WIP to make this work for other
+ * encryption schemes.
+ */
+static void
+diff_inspect_do_decrypt (guestfs_h *g)
+{
+ char **partitions = guestfs_list_partitions (g);
+ if (partitions == NULL)
+ exit (EXIT_FAILURE);
+
+ int need_rescan = 0;
+ size_t i;
+ for (i = 0; partitions[i] != NULL; ++i) {
+ char *type = guestfs_vfs_type (g, partitions[i]);
+ if (type && STREQ (type, "crypto_LUKS")) {
+ char mapname[32];
+ diff_make_mapname (partitions[i], mapname, sizeof mapname);...
2012 Jan 31
2
[PATCH 1/2] examples: code cleanups
do a code cleanup by removing the tailing spaces
Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com>
---
examples/create_disk.c | 2 +-
examples/inspect_vm.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/create_disk.c b/examples/create_disk.c
index f4b9044..bcad6d8 100644
--- a/examples/create_disk.c
+++ b/examples/create_disk.c
@@ -7,7 +7,7
2018 Oct 04
0
[PATCH v2 3/4] inspector: Use libxml writer macros.
...);
static void output_applications (xmlTextWriterPtr xo, char *root);
static void do_xpath (const char *query);
+/* This macro is used by the macros in "libxml2-writer-macros.h"
+ * when an error occurs.
+ */
+#define xml_error(fn) \
+ error (EXIT_FAILURE, errno, \
+ "%s:%d: error constructing XML near call to \"%s\"", \
+ __FILE__, __LINE__, (fn));
+
static void __attribute__((noreturn))
usage (int status)
{
@@ -307,11 +316,6 @@ main (int argc, char *argv[])
exit (EXIT_SU...
2020 Nov 05
1
[PATCH libnbd] copy: Allowing copying from NBD server to NBD server.
This patch is a straightforward refactoring of libnbd?s nbdcopy
program, and not very interesting.
However I have plans for nbdcopy (see full todo below). I would like
to use this utility for virt-v2v as a replacement for ?qemu-img convert?.
qemu-img has caused us a series of problems:
- change in zeroing behaviour caused a big performance regression
- qemu-img reads extents up-front which
2015 May 06
0
Re: libguestfs init problem
...lude <unistd.h>
> #include <guestfs.h>
>
> int
> main (int argc, char *argv[])
> {
> guestfs_h *g;
> size_t i;
>
> g = guestfs_create ();
> if (g == NULL) {
> perror ("failed to create libguestfs handle");
> exit (EXIT_FAILURE);
> }
>
> /* Set the trace flag so that we can see each libguestfs call. */
> guestfs_set_trace (g, 1);
>
> /* Create a raw-format sparse disk image, 512 MB in size. */
> if (guestfs_disk_create (g, "disk.img", "raw", UINT64_C(512)*1024*1024...
2017 Apr 20
1
[PATCH] tests: Replace test-max-disks with several tests.
...39; },
+ { "version", 0, 0, 'V' },
+ { 0, 0, 0, 0 }
+ };
+ int c;
+ int option_index;
+ bool just_add = false;
+ guestfs_h *g;
+ char *tmpdir;
+ ssize_t n = -1; /* -1: not set 0: max > 0: specific value */
+
+ g = guestfs_create ();
+ if (g == NULL)
+ error (EXIT_FAILURE, errno, "guestfs_create");
+
+ for (;;) {
+ c = getopt_long (argc, argv, options, long_options, &option_index);
+ if (c == -1) break;
+
+ switch (c) {
+ case 0: /* options which are long only */
+ if (STREQ (long_options[option_index].name, "just-add"))
+...
2017 Apr 28
2
[PATCH] common/options: Change drv struct to store drive index instead of device name.
...+-
rescue/rescue.c | 3 +--
rescue/suggest.c | 2 +-
17 files changed, 42 insertions(+), 51 deletions(-)
diff --git a/align/scan.c b/align/scan.c
index 7ae8adf..26f77fd 100644
--- a/align/scan.c
+++ b/align/scan.c
@@ -236,7 +236,7 @@ main (int argc, char *argv[])
error (EXIT_FAILURE, 0, _("--uuid option cannot be used with -a or -d"));
/* Add domains/drives from the command line (for a single guest). */
- add_drives (drvs, 'a');
+ add_drives (drvs, 0);
if (guestfs_launch (g) == -1)
exit (EXIT_FAILURE);
diff --git a/cat/cat.c b/cat/c...
2016 May 05
1
[PATCH] tools: improve reporting for option errors (RHBZ#1316041)
...nt 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[])
assert (live == 0);
/* Must...
2015 Jun 18
1
[PATCH] error log: keep more calloc and its error messages match
...b/cat/cat.c
@@ -191,7 +191,7 @@ main (int argc, char *argv[])
access (argv[optind], F_OK) == 0) { /* simulate -a option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
- perror ("malloc");
+ perror ("calloc");
exit (EXIT_FAILURE);
}
drv->type = drv_a;
@@ -205,7 +205,7 @@ main (int argc, char *argv[])
} else { /* simulate -d option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
- perror ("malloc");
+ perror ("calloc")...
2016 Dec 28
2
Help with httpd userdir recovery
...#include <sys/types.h>
#include <dirent.h>
int
main(int argc, char *argv[])
{
struct passwd pwd;
struct passwd *result;
char *buf;
size_t bufsize;
int s;
if (argc != 3) {
fprintf(stderr, "Usage: %s username directory\n", argv[0]);
exit(EXIT_FAILURE);
}
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
if (bufsize == -1) /* Value was indeterminate */
bufsize = 16384; /* Should be more than enough */
buf = malloc(bufsize);
if (buf == NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}...
2014 Mar 20
5
[PATCH 1/3] builder/virt-index-validate: try to cleanup in any occasion
...r/index-validate.c
@@ -62,6 +62,7 @@ main (int argc, char *argv[])
struct section *sections;
struct parse_context context;
FILE *in;
+ int ret;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
@@ -109,19 +110,22 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- if (do_parse (&context, in) != 0) {
- fprintf (stderr, _("%s: '%s' could not be validated, see errors above\n"),
+ ret = do_parse (&context, in);
+
+ if (fclose (in) == EOF) {
+ fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n&q...
2019 Jun 28
3
[libnbd PATCH] tests: Enhance errors test
...printf ("error: \"%s\"\n", msg);
+ printf ("errno: %d (%s)\n", errnum, strerror (errnum));
+ if (strncmp (msg, prefix, strlen (prefix)) != 0) {
+ fprintf (stderr, "%s: test failed: missing context prefix: %s\n",
+ progname, msg);
+ exit (EXIT_FAILURE);
+ }
+ if (errnum != experr) {
+ fprintf (stderr, "%s: test failed: "
+ "expected errno = %d (%s), but got %d\n",
+ progname, experr, strerror (experr), errnum);
+ exit (EXIT_FAILURE);
+ }
+}
+
int
main (int argc, char *argv[])
{
struct nb...
2018 Aug 20
1
[PATCH nbdkit] tests: Add a root only test of the file plugin with
In libguestfs we have a few tests that require root privileges and
they are skipped by default (normally you should not build or test as
root), but you can do this to run them:
sudo make check-root
In nbdkit I wanted to check that the file plugin works with block
devices (this is not tested), and the only way I can sensibly think to
do this is using a loopback device and root. This commit
2019 Jun 04
0
[PATCH libnbd v2 4/4] examples: Add concurrent writer example.
..._t threads[NR_MULTI_CONN];
+ struct thread_status status[NR_MULTI_CONN];
+ size_t i;
+ int err;
+ unsigned requests, most_in_flight, errors;
+
+ srand (time (NULL));
+
+ if (argc < 2 || argc > 3) {
+ fprintf (stderr, "%s uri | socket | hostname port\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ nbd = nbd_create ();
+ if (nbd == NULL) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+
+ /* Connect first to check if the server supports writes and multi-conn. */
+ if (argc == 2) {
+ if (strstr (argv[1], "://")) {
+ i...
2018 Nov 02
7
[PATCH v3 0/4] common/utils: Move libxml2 writer macros to a common header file.
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-October/msg00047.html
v2 was here:
https://www.redhat.com/archives/libguestfs/2018-October/msg00051.html
v3:
- Back to using string/string_format and attribute/attribute_format.
- Add both single_element and single_element_format.
- Rebased and retested.
Rich.
2018 Oct 04
2
[PATCH 0/2] Use common macros to help with libxml2 writer.
Consolidate and extend the use of funky start_element() etc macros.
Rich.