From: Masatake YAMATO Date: Thu, 4 Jan 2024 02:33:51 +0000 (+0900) Subject: lsfd: minimize the output related to lsfd itself X-Git-Tag: v2.42-start~299^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1212849663ce29f6b2b03ab5ffc85375da1f002;p=thirdparty%2Futil-linux.git lsfd: minimize the output related to lsfd itself Copied from the test case in lib/fileutils.c. --- 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