1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

valgrind: when executed within valrind skip close

Since valgrind uses internal file descriptors for communication,
don't try to close them in this case.
This commit is contained in:
Zdenek Kabelac 2015-02-12 15:32:30 +01:00
parent 9809038b9d
commit 77ceb3ee47
2 changed files with 12 additions and 0 deletions

View File

@ -133,6 +133,7 @@ dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
all: device-mapper all: device-mapper
CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS) CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
CFLAGS_lvmcmdline.o += $(VALGRIND_CFLAGS)
lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \ $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \

View File

@ -29,6 +29,10 @@
#include <paths.h> #include <paths.h>
#include <locale.h> #include <locale.h>
#ifdef HAVE_VALGRIND
#include <valgrind.h>
#endif
#ifdef HAVE_GETOPTLONG #ifdef HAVE_GETOPTLONG
# include <getopt.h> # include <getopt.h>
# define GETOPTLONG_FN(a, b, c, d, e) getopt_long((a), (b), (c), (d), (e)) # define GETOPTLONG_FN(a, b, c, d, e) getopt_long((a), (b), (c), (d), (e))
@ -1681,6 +1685,13 @@ static int _close_stray_fds(const char *command)
struct dirent *dirent; struct dirent *dirent;
DIR *d; DIR *d;
#ifdef HAVE_VALGRIND
if (RUNNING_ON_VALGRIND) {
log_debug("Skipping close of descriptors within valgrind execution.");
return 1;
}
#endif
if (getenv("LVM_SUPPRESS_FD_WARNINGS")) if (getenv("LVM_SUPPRESS_FD_WARNINGS"))
suppress_warnings = 1; suppress_warnings = 1;