X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=util%2Fpath-util.c;fp=util%2Fpath-util.c;h=3267a967656b7863c9f1ff6a820780bbfa769c10;hp=0000000000000000000000000000000000000000;hb=441a327051f5357175029709030a0ee51131379d;hpb=62f03b6ab86bdc378198f9c1a86cb51ead289961 diff --git a/util/path-util.c b/util/path-util.c new file mode 100644 index 00000000..3267a967 --- /dev/null +++ b/util/path-util.c @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define _GNU_SOURCE + +#include "path-util.h" + +#include +#include + + +char * +notmuch_canonicalize_file_name (const char *path) +{ +#if HAVE_CANONICALIZE_FILE_NAME + return canonicalize_file_name (path); +#elif defined(PATH_MAX) + char *resolved_path = malloc (PATH_MAX + 1); + if (resolved_path == NULL) + return NULL; + + return realpath (path, resolved_path); +#else +#error undefined PATH_MAX _and_ missing canonicalize_file_name not supported +#endif +}