From 4af6dc96630106a944c72566524c12cafff752fb Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 18 Jan 2002 16:43:19 +0000 Subject: [PATCH] Allow compilation against a device-mapper that was installed into $DESTDIR Always check for negative (error) return code from lv_active() --- make.tmpl.in | 6 +++++- tools/lvchange.c | 5 ++++- tools/lvrename.c | 5 ++++- tools/lvresize.c | 2 +- tools/lvscan.c | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/make.tmpl.in b/make.tmpl.in index 512bf3a62..18beb440a 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -64,6 +64,10 @@ CFLAGS+=-DDEBUG_MEM -DDEBUG INCLUDES+=-I. -I$(top_srcdir)/include INC_LNS=$(top_srcdir)/include/.symlinks_created +ifdef DESTDIR + INCLUDES+=-I$(DESTDIR)/usr/include +endif + STRIP= #STRIP=-s @@ -118,7 +122,7 @@ clean: $(SUBDIRS.clean) distclean: $(SUBDIRS.distclean) $(RM) $(OBJECTS) $(TARGETS) $(SOURCES:%.c=%.d) $(RM) config.cache config.log config.status - $(RM) Makefile make.tmpl + $(RM) Makefile make.tmpl version.h ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) diff --git a/tools/lvchange.c b/tools/lvchange.c index d774f3c65..0b307e3fa 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -139,7 +139,10 @@ static int lvchange_availability(struct logical_volume *lv) if (strcmp(arg_str_value(available_ARG, "n"), "n")) activate = 1; - active = lv_active(lv); + if ((active = lv_active(lv)) < 0) { + log_error("Unable to determine status of %s", lv->name); + return 0; + } if (activate && active) { log_verbose("Logical volume %s is already active", lv->name); diff --git a/tools/lvrename.c b/tools/lvrename.c index 73cf0fe98..926690e0c 100644 --- a/tools/lvrename.c +++ b/tools/lvrename.c @@ -107,7 +107,10 @@ int lvrename(int argc, char **argv) if (!archive(lv->vg)) return ECMD_FAILED; - active = lv_active(lv); + if ((active = lv_active(lv)) < 0) { + log_error("Unable to determine status of %s", lv->name); + return ECMD_FAILED; + } if (active && !lv_suspend(lv)) { log_error("Failed to suspend %s", lv->name); diff --git a/tools/lvresize.c b/tools/lvresize.c index 3c7df5c63..90e799178 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -258,7 +258,7 @@ int lvresize(int argc, char **argv) if (argc) log_print("Ignoring PVs on command line when reducing"); - if (lv_active(lv)) { + if (lv_active(lv) > 0) { dummy = display_size(extents * vg->extent_size / 2, SIZE_SHORT); diff --git a/tools/lvscan.c b/tools/lvscan.c index 2ee7ce98e..52896fda8 100644 --- a/tools/lvscan.c +++ b/tools/lvscan.c @@ -64,7 +64,7 @@ static int lvscan_single(struct logical_volume *lv) const char *active_str, *snapshot_str; /* FIXME Add -D arg to skip this! */ - if (lv_active(lv)) { + if (lv_active(lv) > 0) { active_str = "ACTIVE "; active++; } else