diff options
author | Vicent Marti <tanoku@gmail.com> | 2013-04-16 19:46:41 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-04-16 19:46:41 +0400 |
commit | a50086d174658914d4d6462afbc83b02825b1f5b (patch) | |
tree | e8daa1c7bf678222cf351445179837bed7db3a72 /src/unix/realpath.c | |
parent | 5b9fac39d8a76b9139667c26a63e6b3f204b3977 (diff) | |
parent | f124ebd457bfbf43de3516629aaba5a279636e04 (diff) |
Merge branch 'development'v0.18.0
Diffstat (limited to 'src/unix/realpath.c')
-rw-r--r-- | src/unix/realpath.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/unix/realpath.c b/src/unix/realpath.c new file mode 100644 index 000000000..15601bd22 --- /dev/null +++ b/src/unix/realpath.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#include <git2/common.h> + +#ifdef __OpenBSD__ + +#include <limits.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> + +char *p_realpath(const char *pathname, char *resolved) +{ + char *ret; + + if ((ret = realpath(pathname, resolved)) == NULL) + return NULL; + + /* Figure out if the file exists */ + if (!access(ret, F_OK)) + return ret; + + return NULL; +} + +#endif |