| 1 |
|
| /* |
| 2 |
|
| * Copyright (C) the libgit2 contributors. All rights reserved. |
| 3 |
|
| * |
| 4 |
|
| * This file is part of libgit2, distributed under the GNU GPL v2 with |
| 5 |
|
| * a Linking Exception. For full terms see the included COPYING file. |
| 6 |
|
| */ |
| 7 |
|
| |
| 8 |
|
| #include "git2_util.h" |
| 9 |
|
| |
| 10 |
|
| #ifndef GIT_WIN32 |
| 11 |
|
| |
| 12 |
|
| #include <limits.h> |
| 13 |
|
| #include <stdlib.h> |
| 14 |
|
| #include <fcntl.h> |
| 15 |
|
| #include <unistd.h> |
| 16 |
|
| |
| 17 |
743 |
| char *p_realpath(const char *pathname, char *resolved) |
| 18 |
|
| { |
| 19 |
|
| char *ret; |
| 20 |
743 |
▶ | if ((ret = realpath(pathname, resolved)) == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((ret = realpath(pathname, resolved)) == NULL) |
18 |
725 |
743 |
|
| 21 |
18 |
| return NULL; |
| 22 |
|
| |
| 23 |
|
| #ifdef __OpenBSD__ |
| 24 |
|
| /* The OpenBSD realpath function behaves differently, |
| 25 |
|
| * figure out if the file exists */ |
| 26 |
|
| if (access(ret, F_OK) < 0) |
| 27 |
|
| ret = NULL; |
| 28 |
|
| #endif |
| 29 |
725 |
| return ret; |
| 30 |
|
| } |
| 31 |
|
| |
| 32 |
|
| #endif |