summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-03-18 15:07:54 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-03-18 15:07:54 -0400
commit4f3fb6e44500d6ce4781fbed8d547f6a7891fc66 (patch)
treeee040b07f4915150162f6c5b100da5f5abce723a /src/shared/util.c
parentd80d6e858f7e308f0144c5d01e3eca21b09292d9 (diff)
shared: import close_many() from upstream
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index dc05001a28..f68b687006 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -232,6 +232,15 @@ int safe_close(int fd) {
return -1;
}
+void close_many(const int fds[], unsigned n_fd) {
+ unsigned i;
+
+ assert(fds || n_fd <= 0);
+
+ for (i = 0; i < n_fd; i++)
+ safe_close(fds[i]);
+}
+
int unlink_noerrno(const char *path) {
PROTECT_ERRNO;
int r;