add non-failing close() variant

This commit is contained in:
Lennart Poettering 2010-01-28 01:53:15 +01:00
parent 4901f97278
commit 85f136b5d0
2 changed files with 9 additions and 0 deletions

8
util.c
View File

@ -97,6 +97,14 @@ int close_nointr(int fd) {
}
}
void close_nointr_nofail(int fd) {
/* like close_nointr() but cannot fail, and guarantees errno
* is unchanged */
assert_se(close_nointr(fd) == 0);
}
int parse_boolean(const char *v) {
assert(v);

1
util.h
View File

@ -61,6 +61,7 @@ bool endswith(const char *s, const char *postfix);
bool startswith(const char *s, const char *prefix);
int close_nointr(int fd);
void close_nointr_nofail(int fd);
int parse_boolean(const char *v);