Daniel Veillard <veillard(a)redhat.com> wrote:
On Fri, Feb 22, 2008 at 02:58:36PM +0100, Jim Meyering wrote:
> Move safewrite and saferead to a separate file.
...
I realized this morning that as is this didn't worked well if
virsh
was compiled against a static version of the library, since the function
would be redefined and an error shows up at link time. The enclosed patch
is the simplest we could find with Jim to solve the issue, it just renames
the safe function when compiled inside the library,
Index: src/Makefile.am
...
- libvirt_la_CFLAGS = $(COVERAGE_CFLAGS)
+ libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT
...
Index: src/util-lib.h
...
+ /*
+ * To avoid a double definition of the function when compiling
+ * programs using both util-lib and libvirt, like virsh
+ */
+ #ifdef IN_LIBVIRT
+ #define saferead libvirt_saferead
+ #define safewrite libvirt_safewrite
+ #endif
Looks fine.
Thanks for cleaning up after me.