summaryrefslogtreecommitdiff
path: root/dlib
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2013-01-09 12:47:23 -0300
committerJorge Arellano Cid <jcid@dillo.org>2013-01-09 12:47:23 -0300
commitcbba835b154ba31e7a07ba1b15a06b8953eb7e72 (patch)
tree8ea8ad0b67ba6a2f8a789f9e61ea4f80d0c20d35 /dlib
parentd236210c1608952b7910123fbede108317a80444 (diff)
Refactored FD close calls into a single new dClose() dlib function [p37sitdu]
Diffstat (limited to 'dlib')
-rw-r--r--dlib/dlib.c12
-rw-r--r--dlib/dlib.h8
2 files changed, 16 insertions, 4 deletions
diff --git a/dlib/dlib.c b/dlib/dlib.c
index ebdaf0cd..d60f1bc6 100644
--- a/dlib/dlib.c
+++ b/dlib/dlib.c
@@ -931,3 +931,15 @@ char *dGetline (FILE *stream)
return line;
}
+/*
+ * Close a FD handling EINTR.
+ */
+int dClose(int fd)
+{
+ int st;
+
+ do
+ st = close(fd);
+ while (st == -1 && errno == EINTR);
+ return st;
+}
diff --git a/dlib/dlib.h b/dlib/dlib.h
index 8dc324a7..0d194dbe 100644
--- a/dlib/dlib.h
+++ b/dlib/dlib.h
@@ -175,10 +175,10 @@ void dLib_show_messages(bool_t show);
/*
*- Misc utility functions ----------------------------------------------------
*/
-char *dGetcwd ();
-char *dGethomedir ();
-char *dGetline (FILE *stream);
-
+char *dGetcwd();
+char *dGethomedir();
+char *dGetline(FILE *stream);
+int dClose(int fd);
#ifdef __cplusplus
}