From e1212849663ce29f6b2b03ab5ffc85375da1f002 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Thu, 4 Jan 2024 11:33:51 +0900 Subject: [PATCH] lsfd: minimize the output related to lsfd itself Copied from the test case in lib/fileutils.c. --- lsfd-cmd/lsfd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c index a54b08550..017298e09 100644 --- a/lsfd-cmd/lsfd.c +++ b/lsfd-cmd/lsfd.c @@ -2689,6 +2689,12 @@ int main(int argc, char *argv[]) if (scols_table_get_column_by_name(ctl.tb, "XMODE")) ctl.show_xmode = 1; + /* Minimize the output related to lsfd itself. */ +# ifdef HAVE_CLOSE_RANGE + if (close_range(STDERR_FILENO + 1, ~0U, 0) < 0) +# endif + ul_close_all_fds(STDERR_FILENO + 1, ~0U); + /* collect data * * The call initialize_ipc_table() must come before -- 2.47.3