From af5c3afa91cc29268c6754ea70f15cae30f22403 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 27 Jan 2014 10:12:12 -0400 Subject: compat: add canonicalize_file_name the POSIX 2008 behaviour of realpath is not available everywhere so we provide a simple wrapper function. We use (and provide) the gnu extension canonicalize_file_name to make it cleaner to test for the feature we need; otherwise we have to rely on realpath segfaulting if the second argument is null. --- compat/compat.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compat/compat.h') diff --git a/compat/compat.h b/compat/compat.h index 5a402d5c..634d505b 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -37,6 +37,14 @@ extern "C" { #define _POSIX_PTHREAD_SEMANTICS 1 #endif +#if !HAVE_CANONICALIZE_FILE_NAME +/* we only call this function from C, and this makes testing easier */ +#ifndef __cplusplus +char * +canonicalize_file_name (const char *path); +#endif +#endif + #if !HAVE_GETLINE #include #include -- cgit v1.2.3