Chen Hanxiao
2015-Jun-18 08:35 UTC
[Libguestfs] [PATCH] error log: keep more calloc and its error messages match
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- cat/cat.c | 4 ++-- cat/ls.c | 4 ++-- daemon/md.c | 2 +- daemon/stat.c | 2 +- daemon/xattr.c | 2 +- df/main.c | 4 ++-- edit/edit.c | 4 ++-- fish/fish.c | 6 +++--- fish/options.c | 4 ++-- inspector/inspector.c | 4 ++-- rescue/rescue.c | 6 +++--- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cat/cat.c b/cat/cat.c index 5a438ce..82f0055 100644 --- a/cat/cat.c +++ 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"); exit (EXIT_FAILURE); } drv->type = drv_d; diff --git a/cat/ls.c b/cat/ls.c index 9161fb6..3bced54 100644 --- a/cat/ls.c +++ b/cat/ls.c @@ -293,7 +293,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; @@ -307,7 +307,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_d; diff --git a/daemon/md.c b/daemon/md.c index 941d05d..08a17e3 100644 --- a/daemon/md.c +++ b/daemon/md.c @@ -394,7 +394,7 @@ parse_md_stat_line (char *line) ret->guestfs_int_mdstat_list_val calloc (spaces+1, sizeof (struct guestfs_int_mdstat)); if (ret->guestfs_int_mdstat_list_val == NULL) { - reply_with_perror ("malloc"); + reply_with_perror ("calloc"); free (ret); return NULL; } diff --git a/daemon/stat.c b/daemon/stat.c index a784914..73f1922 100644 --- a/daemon/stat.c +++ b/daemon/stat.c @@ -138,7 +138,7 @@ do_internal_lstatnslist (const char *path, char *const *names) ret->guestfs_int_statns_list_val calloc (nr_names, sizeof (guestfs_int_statns)); if (ret->guestfs_int_statns_list_val == NULL) { - reply_with_perror ("malloc"); + reply_with_perror ("calloc"); free (ret); return NULL; } diff --git a/daemon/xattr.c b/daemon/xattr.c index c32e1a7..8aa28d1 100644 --- a/daemon/xattr.c +++ b/daemon/xattr.c @@ -120,7 +120,7 @@ getxattrs (const char *path, r = calloc (1, sizeof (*r)); if (r == NULL) { - reply_with_perror ("malloc"); + reply_with_perror ("calloc"); goto error; } diff --git a/df/main.c b/df/main.c index a43c11f..517bd45 100644 --- a/df/main.c +++ b/df/main.c @@ -217,7 +217,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; @@ -231,7 +231,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_d; diff --git a/edit/edit.c b/edit/edit.c index 775170b..b874492 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -226,7 +226,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; @@ -240,7 +240,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_d; diff --git a/fish/fish.c b/fish/fish.c index 714a13c..c37368e 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -361,7 +361,7 @@ main (int argc, char *argv[]) } drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_N; @@ -449,7 +449,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; @@ -463,7 +463,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_d; diff --git a/fish/options.c b/fish/options.c index b1be711..da5015d 100644 --- a/fish/options.c +++ b/fish/options.c @@ -38,7 +38,7 @@ option_a (const char *arg, const char *format, struct drv **drvsp) drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } @@ -84,7 +84,7 @@ option_d (const char *arg, struct drv **drvsp) drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } diff --git a/inspector/inspector.c b/inspector/inspector.c index 412384a..70b7cd3 100644 --- a/inspector/inspector.c +++ b/inspector/inspector.c @@ -196,7 +196,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; @@ -210,7 +210,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_d; diff --git a/rescue/rescue.c b/rescue/rescue.c index 8c0b507..9e0a516 100644 --- a/rescue/rescue.c +++ b/rescue/rescue.c @@ -253,7 +253,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; @@ -267,7 +267,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_d; @@ -530,7 +530,7 @@ add_scratch_disk (struct drv **drvs) /* Add the scratch disk to the drives list. */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_scratch; -- 2.1.0
Richard W.M. Jones
2015-Jun-18 08:48 UTC
Re: [Libguestfs] [PATCH] error log: keep more calloc and its error messages match
Thanks - I will push this shortly. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Maybe Matching Threads
- [PATCH 1/2] Use 'error' function consistently throughout.
- [PATCH] common/options: Change drv struct to store drive index instead of device name.
- [PATCH V2] virt-diff: add new virt-diff tool
- [common PATCH v2 1/1] options: add '--blocksize' option for C-based tools
- [common PATCH] options: add '--blocksize' option for C-based tools