X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=compat%2Fcanonicalize_file_name.c;fp=compat%2Fcanonicalize_file_name.c;h=e92c0f6253636b435087680a562092feb352ed5e;hp=0000000000000000000000000000000000000000;hb=af5c3afa91cc29268c6754ea70f15cae30f22403;hpb=134dbadaf517c6962c2588f36f1f8782277e2f95 diff --git a/compat/canonicalize_file_name.c b/compat/canonicalize_file_name.c new file mode 100644 index 00000000..e92c0f62 --- /dev/null +++ b/compat/canonicalize_file_name.c @@ -0,0 +1,18 @@ +#include "compat.h" +#include +#undef _GNU_SOURCE +#include + +char * +canonicalize_file_name (const char * path) +{ +#ifdef 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 +}