Commit 1f7ba617 authored by hamaji@chromium.org's avatar hamaji@chromium.org

Implement lstat by stat in nacl_io

As nacl_io does not support

TEST=./build_tools/build_sdk.py
TEST=./build_tools/test_sdk.py

Review URL: https://codereview.chromium.org/125693002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243771 0039d316-1c4b-4281-b951-d872f2087c98
parent 332577dd
......@@ -634,8 +634,7 @@ int KernelProxy::truncate(const char* path, off_t len) {
}
int KernelProxy::lstat(const char* path, struct stat* buf) {
errno = ENOSYS;
return -1;
return stat(path, buf);
}
int KernelProxy::rename(const char* path, const char* newpath) {
......
......@@ -416,6 +416,24 @@ TEST_F(KernelProxyTest, MemMountDup) {
// fd, new_fd, dup_fd -> "/bar"
}
TEST_F(KernelProxyTest, Lstat) {
int fd = ki_open("/foo", O_CREAT | O_RDWR);
ASSERT_GT(fd, -1);
ASSERT_EQ(0, ki_mkdir("/bar", S_IREAD | S_IWRITE));
struct stat buf;
EXPECT_EQ(0, ki_lstat("/foo", &buf));
EXPECT_EQ(0, buf.st_size);
EXPECT_TRUE(S_ISREG(buf.st_mode));
EXPECT_EQ(0, ki_lstat("/bar", &buf));
EXPECT_EQ(0, buf.st_size);
EXPECT_TRUE(S_ISDIR(buf.st_mode));
EXPECT_EQ(-1, ki_lstat("/no-such-file", &buf));
EXPECT_EQ(ENOENT, errno);
}
namespace {
StringMap_t g_string_map;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment