aboutsummaryrefslogtreecommitdiffhomepage
path: root/compat/compat.h
diff options
context:
space:
mode:
authorGravatar David Bremner <david@tethera.net>2014-01-27 10:12:12 -0400
committerGravatar David Bremner <david@tethera.net>2014-04-08 07:27:14 -0300
commitaf5c3afa91cc29268c6754ea70f15cae30f22403 (patch)
treecc1fe830310c9debb7de0a19f707c06858479697 /compat/compat.h
parent134dbadaf517c6962c2588f36f1f8782277e2f95 (diff)
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.
Diffstat (limited to 'compat/compat.h')
-rw-r--r--compat/compat.h8
1 files changed, 8 insertions, 0 deletions
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 <stdio.h>
#include <unistd.h>