]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/util.c
util: add a bit of syntactic sugar for saving/restoring errno
[thirdparty/systemd.git] / src / shared / util.c
index 46c20bec9c1c43456ad707d9b87c197fbc1ec4bb..b69e7e882a8803546e205e97cd63a99e76f1057b 100644 (file)
@@ -207,14 +207,12 @@ int close_nointr(int fd) {
 }
 
 void close_nointr_nofail(int fd) {
-        int saved_errno = errno;
+        PROTECT_ERRNO;
 
         /* like close_nointr() but cannot fail, and guarantees errno
          * is unchanged */
 
         assert_se(close_nointr(fd) == 0);
-
-        errno = saved_errno;
 }
 
 void close_many(const int fds[], unsigned n_fd) {