summaryrefslogtreecommitdiff
path: root/tools/lvmcmdline.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-02-12 15:32:30 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2015-02-12 15:40:54 +0100
commit77ceb3ee471075ce55f723a2efffb4465510ea88 (patch)
tree6a2ca09405776324711876af7455896ad7bfa7df /tools/lvmcmdline.c
parent9809038b9d3beddd90cb80311c61fd67856e0728 (diff)
downloadlvm2-77ceb3ee471075ce55f723a2efffb4465510ea88.tar.gz
valgrind: when executed within valrind skip close
Since valgrind uses internal file descriptors for communication, don't try to close them in this case.
Diffstat (limited to 'tools/lvmcmdline.c')
-rw-r--r--tools/lvmcmdline.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 1cdc2937a..e5867772d 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -29,6 +29,10 @@
#include <paths.h>
#include <locale.h>
+#ifdef HAVE_VALGRIND
+#include <valgrind.h>
+#endif
+
#ifdef HAVE_GETOPTLONG
# include <getopt.h>
# 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;
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"))
suppress_warnings = 1;