X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=util.c;h=654b93d79c084ceb25b944aa3e62a1112204303a;hb=071830ff32351c19343ff1f0343c13d5c2b69250;hp=56f53eafd66caf1872c5e4d9954bb1a84c0177a3;hpb=4a72ff34c62f18559e96b35d69c665e07290f228;p=elogind.git diff --git a/util.c b/util.c index 56f53eafd..654b93d79 100644 --- a/util.c +++ b/util.c @@ -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); @@ -480,6 +488,7 @@ int reset_all_signal_handlers(void) { zero(sa); sa.sa_handler = SIG_DFL; + sa.sa_flags = SA_RESTART; /* On Linux the first two RT signals are reserved by * glibc, and sigaction() will return EINVAL for them. */