]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: minimize the output related to lsfd itself
authorMasatake YAMATO <yamato@redhat.com>
Thu, 4 Jan 2024 02:33:51 +0000 (11:33 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 7 Jun 2024 18:12:11 +0000 (03:12 +0900)
Copied from the test case in lib/fileutils.c.

lsfd-cmd/lsfd.c

index a54b0855094f079ed694e0ed69b5d4f27508b50a..017298e09789f2bb031b7864a0721009c7fa5ba8 100644 (file)
@@ -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