1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

daemon-stray: compile also with VALGRIND_POOL

We can run and build this code just fine with VALGRIND_POOL
and just rely on runtime detection - so we do not close
descriptors also within running valgrind session.
This commit is contained in:
Zdenek Kabelac 2024-04-25 21:07:36 +02:00
parent 4557427a61
commit 4c5eb2e713

View File

@ -25,8 +25,6 @@
* When compiling with valgrind pool support, skip closing descriptors * When compiling with valgrind pool support, skip closing descriptors
* as there is couple more of them being held by valgrind itself. * as there is couple more of them being held by valgrind itself.
*/ */
#ifndef VALGRIND_POOL
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -102,8 +100,6 @@ static void _daemon_close_descriptor(int fd, unsigned suppress_warnings,
fprintf(stderr, " Parent PID %d: %s\n", (int)ppid, parent_cmdline); fprintf(stderr, " Parent PID %d: %s\n", (int)ppid, parent_cmdline);
} }
#endif /* VALGRIND_POOL */
/* Close all stray descriptor except custom fds. /* Close all stray descriptor except custom fds.
* Note: when 'from_fd' is set to -1, unused 'custom_fds' must use same value! * Note: when 'from_fd' is set to -1, unused 'custom_fds' must use same value!
* *
@ -115,7 +111,6 @@ static void _daemon_close_descriptor(int fd, unsigned suppress_warnings,
static int daemon_close_stray_fds(const char *command, int suppress_warning, static int daemon_close_stray_fds(const char *command, int suppress_warning,
int from_fd, const struct custom_fds *custom_fds) int from_fd, const struct custom_fds *custom_fds)
{ {
#ifndef VALGRIND_POOL
struct rlimit rlim; struct rlimit rlim;
int fd; int fd;
unsigned suppress_warnings = 0; unsigned suppress_warnings = 0;
@ -162,7 +157,7 @@ static int daemon_close_stray_fds(const char *command, int suppress_warning,
} }
} else } else
return 0; /* broken system */ return 0; /* broken system */
#endif /* VALGRIND_POOL */
return 1; return 1;
} }