Welcome to mirror list, hosted at ThFree Co, Russian Federation.

realpath.c « unix « src - github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15601bd2285596d331757a9abcd64249ec403e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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