summaryrefslogtreecommitdiff
path: root/function.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2009-07-04 11:33:33 +0000
committerEli Zaretskii <eliz@gnu.org>2009-07-04 11:33:33 +0000
commite8fd23cc83ecfe4b8b0cce884bb3573fa5e9f0e0 (patch)
treecbfd0d09ecf784f31a2ba85c7d28322e4dbd8d57 /function.c
parent1471af2de285eaf67ab8f245d001efbed1c8c338 (diff)
downloadgunmake-e8fd23cc83ecfe4b8b0cce884bb3573fa5e9f0e0.tar.gz
(func_realpath) [!HAVE_REALPATH]: Require the file to exist, as
realpath(3) does where it's supported.
Diffstat (limited to 'function.c')
-rw-r--r--function.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/function.c b/function.c
index bb2f116..c7e1d4f 100644
--- a/function.c
+++ b/function.c
@@ -1998,6 +1998,9 @@ func_realpath (char *o, char **argv, const char *funcname UNUSED)
const char *path = 0;
int doneany = 0;
unsigned int len = 0;
+#ifndef HAVE_REALPATH
+ struct stat st;
+#endif
PATH_VAR (in);
PATH_VAR (out);
@@ -2012,7 +2015,7 @@ func_realpath (char *o, char **argv, const char *funcname UNUSED)
#ifdef HAVE_REALPATH
realpath (in, out)
#else
- abspath (in, out)
+ abspath (in, out) && stat (out, &st) == 0
#endif
)
{