2 * Copyright 2013, Olivier Coursière, olivier.coursiere@laposte.net.
3 * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
4 * Distributed under the terms of the MIT License.
13 #include <errno_private.h>
18 realpath(const char* path
, char* resolved
)
20 char* resolvedPath
= resolved
;
22 if (resolvedPath
== NULL
) {
23 resolvedPath
= (char*)malloc(PATH_MAX
+ 1);
24 if (resolvedPath
== NULL
) {
25 __set_errno(B_NO_MEMORY
);
30 status_t status
= _kern_normalize_path(path
, true, resolvedPath
);
38 // The path must actually exist, not just its parent directories
40 if (lstat(resolvedPath
, &stat
) != 0) {