From cbba835b154ba31e7a07ba1b15a06b8953eb7e72 Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Wed, 9 Jan 2013 12:47:23 -0300 Subject: Refactored FD close calls into a single new dClose() dlib function [p37sitdu] --- dlib/dlib.c | 12 ++++++++++++ dlib/dlib.h | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'dlib') 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 } -- cgit v1.2.3