Map the fssh_*stat() functions to _kern_read_stat() in libroot_build on

BeOS incompatible platforms. Thus *stat()ing symlinks works.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22178 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-09-05 03:01:41 +00:00
parent 4291baf0db
commit d249fa1b2c

View File

@ -7,8 +7,11 @@
#include "fssh_stat.h"
#include <SupportDefs.h>
#include <sys/stat.h>
#include "fssh_errno.h"
#include "stat_util.h"
@ -16,6 +19,13 @@ using FSShell::from_platform_stat;
using FSShell::to_platform_mode;
#ifndef __BEOS__
// The _kern_read_stat() defined in libroot_build.so.
extern "C" status_t _kern_read_stat(int fd, const char *path,
bool traverseLink, struct stat *st, size_t statSize);
#endif
int
fssh_mkdir(const char *path, fssh_mode_t mode)
{
@ -27,8 +37,19 @@ int
fssh_stat(const char *path, struct fssh_stat *fsshStat)
{
struct stat st;
// Use the _kern_read_stat() defined in libroot on BeOS incompatible
// systems. Required for support for opening symlinks.
#if __BEOS__
if (stat(path, &st) < 0)
return -1;
#else
status_t error = _kern_read_stat(-1, path, true, &st, sizeof(st));
if (error < 0) {
fssh_set_errno(error);
return -1;
}
#endif
from_platform_stat(&st, fsshStat);
@ -40,8 +61,19 @@ int
fssh_fstat(int fd, struct fssh_stat *fsshStat)
{
struct stat st;
// Use the _kern_read_stat() defined in libroot on BeOS incompatible
// systems. Required for support for opening symlinks.
#if __BEOS__
if (fstat(fd, &st) < 0)
return -1;
#else
status_t error = _kern_read_stat(fd, NULL, false, &st, sizeof(st));
if (error < 0) {
fssh_set_errno(error);
return -1;
}
#endif
from_platform_stat(&st, fsshStat);
@ -53,8 +85,19 @@ int
fssh_lstat(const char *path, struct fssh_stat *fsshStat)
{
struct stat st;
// Use the _kern_read_stat() defined in libroot on BeOS incompatible
// systems. Required for support for opening symlinks.
#if __BEOS__
if (lstat(path, &st) < 0)
return -1;
#else
status_t error = _kern_read_stat(-1, path, false, &st, sizeof(st));
if (error < 0) {
fssh_set_errno(error);
return -1;
}
#endif
from_platform_stat(&st, fsshStat);