From: sangwan.kwon Date: Fri, 14 Jul 2017 07:23:37 +0000 (+0900) Subject: Fix file-system API to use lstat instead of stat X-Git-Tag: submit/tizen/20170720.071940^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d866a7170f87d406d8c9bc3722d9db08d54d7c17;p=platform%2Fcore%2Fsecurity%2Fklay.git Fix file-system API to use lstat instead of stat Change-Id: I29f70eab30e4d7f729a6b2efbcf336e555f7b2eb Signed-off-by: sangwan.kwon --- diff --git a/src/filesystem.cpp b/src/filesystem.cpp index c264b7b..7becd1d 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -48,7 +48,7 @@ File::~File() bool File::exists() const { struct stat st; - return (::stat(path.c_str(), &st) == 0); + return (::lstat(path.c_str(), &st) == 0); } bool File::canRead() const @@ -91,7 +91,7 @@ bool File::isLink() const bool File::isFile() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -101,7 +101,7 @@ bool File::isFile() const bool File::isDirectory() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -111,7 +111,7 @@ bool File::isDirectory() const bool File::isDevice() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -121,7 +121,7 @@ bool File::isDevice() const mode_t File::getMode() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -131,7 +131,7 @@ mode_t File::getMode() const uid_t File::getUid() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -141,7 +141,7 @@ uid_t File::getUid() const gid_t File::getGid() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -151,7 +151,7 @@ gid_t File::getGid() const ino_t File::getInode() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -161,7 +161,7 @@ ino_t File::getInode() const dev_t File::getDevice() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); } @@ -171,7 +171,7 @@ dev_t File::getDevice() const off_t File::size() const { struct stat st; - if (::stat(path.c_str(), &st) != 0) { + if (::lstat(path.c_str(), &st) != 0) { throw runtime::Exception(runtime::GetSystemErrorMessage()); }