summaryrefslogtreecommitdiff
path: root/function.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-02-28 00:55:15 -0500
committerPaul Smith <psmith@gnu.org>2013-02-28 00:55:15 -0500
commit450b7e1a3d3f0b9c84f9b8f6909fa844afacbec5 (patch)
tree8d3d5b4a83eb504559e37d2bf18b5656155934b7 /function.c
parent5058a94ee717d96285da20423324af3478df175d (diff)
downloadgunmake-450b7e1a3d3f0b9c84f9b8f6909fa844afacbec5.tar.gz
Use ENULLLOOP to handle EINTR during realpath(). Fixes Savannah bug #38420
Diffstat (limited to 'function.c')
-rw-r--r--function.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/function.c b/function.c
index b6060d6..1242d9a 100644
--- a/function.c
+++ b/function.c
@@ -2070,28 +2070,35 @@ func_realpath (char *o, char **argv, const char *funcname UNUSED)
const char *path = 0;
int doneany = 0;
unsigned int len = 0;
- struct stat st;
- PATH_VAR (in);
- PATH_VAR (out);
while ((path = find_next_token (&p, &len)) != 0)
{
if (len < GET_PATH_MAX)
{
+ char *rp;
+ struct stat st;
+ PATH_VAR (in);
+ PATH_VAR (out);
+
strncpy (in, path, len);
in[len] = '\0';
- if (
#ifdef HAVE_REALPATH
- realpath (in, out)
+ ENULLLOOP (rp, realpath (in, out));
#else
- abspath (in, out)
+ rp = abspath (in, out);
#endif
- && stat (out, &st) == 0)
+
+ if (rp)
{
- o = variable_buffer_output (o, out, strlen (out));
- o = variable_buffer_output (o, " ", 1);
- doneany = 1;
+ int r;
+ EINTRLOOP (r, stat (out, &st));
+ if (r == 0)
+ {
+ o = variable_buffer_output (o, out, strlen (out));
+ o = variable_buffer_output (o, " ", 1);
+ doneany = 1;
+ }
}
}
}
@@ -2150,13 +2157,14 @@ func_abspath (char *o, char **argv, const char *funcname UNUSED)
const char *path = 0;
int doneany = 0;
unsigned int len = 0;
- PATH_VAR (in);
- PATH_VAR (out);
while ((path = find_next_token (&p, &len)) != 0)
{
if (len < GET_PATH_MAX)
{
+ PATH_VAR (in);
+ PATH_VAR (out);
+
strncpy (in, path, len);
in[len] = '\0';
@@ -2191,7 +2199,7 @@ func_abspath (char *o, char **argv, const char *funcname UNUSED)
static char *func_call (char *o, char **argv, const char *funcname);
#define FT_ENTRY(_name, _min, _max, _exp, _func) \
- { (_func), STRING_SIZE_TUPLE(_name), (_min), (_max), (_exp), 0 }
+ { { (_func) }, STRING_SIZE_TUPLE(_name), (_min), (_max), (_exp), 0 }
static struct function_table_entry function_table_init[] =
{