Fixes realpath for beos uses. As beos also misses fchdir...

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@423 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues
2008-12-27 13:57:53 +00:00
parent 77f745e1f0
commit 321187693c
3 changed files with 10 additions and 4 deletions

View File

@@ -32,12 +32,13 @@ static char *sep(char *path)
char *realpath(const char *_path, char *resolved_path)
{
int fd = open(".", O_RDONLY), l;
char current_dir_path[PATH_MAX];
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
char tmp2[PATH_MAX];
if (fd < 0) {
return NULL;
}
getcwd(current_dir_path,PATH_MAX);
strncpy(path, _path, PATH_MAX);
if (chdir(path)) {
@@ -79,7 +80,7 @@ char *realpath(const char *_path, char *resolved_path)
strcat(resolved_path, tmp);
abort:
fchdir(fd);
chdir(current_dir_path);
close(fd);
return resolved_path;
}