chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
11adc1a
)
util: simplify close_nointr() a bit
author
Lennart Poettering
<lennart@poettering.net>
Thu, 21 Aug 2014 14:13:15 +0000
(16:13 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 21 Aug 2014 15:24:21 +0000
(17:24 +0200)
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index 9d254e046414eb4ad0344bb980e3daa6154e2161..a54e8799530d4e2e3b40161ef1c618c14b6109a7 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-175,25
+175,24
@@
char* first_word(const char *s, const char *word) {
}
int close_nointr(int fd) {
}
int close_nointr(int fd) {
- int r;
-
assert(fd >= 0);
assert(fd >= 0);
- r = close(fd);
- if (r >= 0)
- return r;
- else if (errno == EINTR)
- /*
- * Just ignore EINTR; a retry loop is the wrong
- * thing to do on Linux.
- *
- * http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
- * https://bugzilla.gnome.org/show_bug.cgi?id=682819
- * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
- * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain
- */
+
+ if (close(fd) >= 0)
return 0;
return 0;
- else
- return -errno;
+
+ /*
+ * Just ignore EINTR; a retry loop is the wrong thing to do on
+ * Linux.
+ *
+ * http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
+ * https://bugzilla.gnome.org/show_bug.cgi?id=682819
+ * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
+ * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain
+ */
+ if (errno == EINTR)
+ return 0;
+
+ return -errno;
}
int safe_close(int fd) {
}
int safe_close(int fd) {