]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/fileutils: add close_all_fds()
authorKarel Zak <kzak@redhat.com>
Thu, 17 Oct 2019 08:36:27 +0000 (10:36 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Oct 2019 08:44:57 +0000 (10:44 +0200)
commit488f65fcb819e20d2e6c611597bde40b911a8212
tree8b6418a1cbdf0db74f6928391128fdad5c0a263a
parent93c2723772ed22b4950c35a5b918a12dc35bc1ae
lib/fileutils: add close_all_fds()

The classic way which is based on file-descriptors table size is
pretty expensive (due to table size) and forces code to do many
unnecessary close() calls. It seems better to use /proc/self/fds and
close used descriptors only.

Addresses: https://github.com/karelzak/util-linux/issues/883
Signed-off-by: Karel Zak <kzak@redhat.com>
include/fileutils.h
lib/fileutils.c