two small patches to appease clang/llvm static analysis
by Jim Meyering
I ran libguestfs through llvm+clang, today,
[http://clang.llvm.org/StaticAnalysis.html]
It found only two things worth changing -- neither is a real problems.
Adding the noreturn makes it so the tool understands line 541 of
guestfs.c is truly reachable only for non-NULL "p":
540 if (!p) g->abort_cb ();
541 memcpy (p, ptr, size);
>From 41f8b506924243d4fd7570913fbbbd9f8040e11f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 31 Aug 2009 19:51:46 +0200
Subject: [PATCH libguestfs 1/2] maint: guestfs.c: remove unnecessary initialization
* src/guestfs.c (guestfs__receive_file_sync): Don't set "r",
only to ignore it.
---
src/guestfs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/guestfs.c b/src/guestfs.c
index 145f0f3..20afb63 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -2413,7 +2413,7 @@ guestfs__receive_file_sync (guestfs_h *g, const char *filename)
return -1;
}
- while ((r = receive_file_data_sync (g, NULL, NULL)) > 0)
+ while (receive_file_data_sync (g, NULL, NULL) > 0)
; /* just discard it */
return -1;
--
1.6.4.2.384.g5fc62
>From 97ef6a82ed32404b751a23b6658e0f9c7ab3298c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 31 Aug 2009 20:29:08 +0200
Subject: [PATCH libguestfs 2/2] maint: guestfs.c: avoid warning about possible NULL deref from llvm/clang
* src/guestfs.h (guestfs_abort_cb): Declare with attribute noreturn.
---
src/guestfs.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/guestfs.h b/src/guestfs.h
index f2e108b..6412a53 100644
--- a/src/guestfs.h
+++ b/src/guestfs.h
@@ -41,7 +41,7 @@ extern void guestfs_close (guestfs_h *g);
extern const char *guestfs_last_error (guestfs_h *g);
typedef void (*guestfs_error_handler_cb) (guestfs_h *g, void *data, const char *msg);
-typedef void (*guestfs_abort_cb) (void);
+typedef void (*guestfs_abort_cb) (void) __attribute__((__noreturn__));
extern void guestfs_set_error_handler (guestfs_h *g, guestfs_error_handler_cb cb, void *data);
extern guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g, void **data_rtn);
--
1.6.4.2.384.g5fc62
15 years, 2 months
[PATCH libguestfs] avoid build-from-scratch failure due to missing daemon/configure
by Jim Meyering
>From cfab42b40752f6dc44971b3c48523b917b374e91 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 4 Sep 2009 18:00:23 +0200
Subject: [PATCH libguestfs] avoid build-from-scratch failure due to missing daemon/configure
* bootstrap: Don't use autoreconf's --norecursive
option. We require the default --recursive behavior in order
to create daemon/configure. Reported by Matthew Booth.
---
bootstrap | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/bootstrap b/bootstrap
index c3f7d6e..60e71fd 100755
--- a/bootstrap
+++ b/bootstrap
@@ -82,5 +82,4 @@ $gnulib_tool \
--import $modules
# Disable autopoint and libtoolize, since they were already done above.
-AUTOPOINT=true LIBTOOLIZE=true \
- autoreconf --verbose --install --no-recursive
+AUTOPOINT=true LIBTOOLIZE=true autoreconf --verbose --install
--
1.6.4.2.409.g85dc3
15 years, 2 months