mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Option to suppress warnings of file descriptors left open.
This commit is contained in:
parent
aa70fe8b71
commit
432cd1e47a
@ -1,6 +1,7 @@
|
||||
Version 2.01.06 -
|
||||
====================================
|
||||
Suppress 'open failed' error messages during scanning.
|
||||
Option to suppress warnings of file descriptors left open.
|
||||
Fix default value of metadatacopies in documentation (2->1).
|
||||
Fix clvmd-gulm locking.
|
||||
./configure --enable-debug now enables debugging code in clvmd.
|
||||
|
@ -978,6 +978,7 @@ static void _close_stray_fds(void)
|
||||
{
|
||||
struct rlimit rlim;
|
||||
int fd;
|
||||
char *suppress_warnings = NULL;
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
||||
fprintf(stderr, "getrlimit(RLIMIT_NOFILE) failed: %s\n",
|
||||
@ -985,8 +986,13 @@ static void _close_stray_fds(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (getenv("LVM_SUPPRESS_FD_WARNINGS"))
|
||||
suppress_warnings = 1;
|
||||
|
||||
for (fd = 3; fd < rlim.rlim_cur; fd++) {
|
||||
if (!close(fd))
|
||||
if (suppress_warnings)
|
||||
close(fd);
|
||||
else if (!close(fd))
|
||||
fprintf(stderr, "File descriptor %d left open\n", fd);
|
||||
else if (errno != EBADF)
|
||||
fprintf(stderr, "Close failed on stray file "
|
||||
|
Loading…
Reference in New Issue
Block a user