From 710e8e6f6f8c43e68bc4ee067bf7c9e37ca1f4e6 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 4 Jul 1994 21:46:58 +0000 Subject: [PATCH] (safe_stat): New function, EINTR-safe wrapper around stat. --- misc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/misc.c b/misc.c index 06be0b2..b9e76b9 100644 --- a/misc.c +++ b/misc.c @@ -716,3 +716,23 @@ get_path_max () return value; } #endif + +/* On some systems, stat can return EINTR. */ + +int +safe_stat (name, buf) + char *name; + struct stat *buf; +{ + int ret; + +#ifdef EINTR + do +#endif + ret = stat (name, buf); +#ifdef EINTR + while (ret < 0 && errno == EINTR); +#endif + + return ret; +} -- 2.7.4