Remove unused code from filesystem.cpp/.h 81/236481/7
authorTomasz Swierczek <t.swierczek@samsung.com>
Wed, 17 Jun 2020 09:34:41 +0000 (11:34 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 18 Jun 2020 12:15:14 +0000 (14:15 +0200)
Change-Id: I5a4b722e34ba1bb691a0edf576b3e83a3b9499e0

src/common/filesystem.cpp
src/common/include/filesystem.h

index bf0e93208568d294b73dad6182bb03ba812bbdeb..371cd1f54e0d7a6771f5c4a16c8509f3df3e6895 100644 (file)
@@ -176,17 +176,6 @@ bool fileExists(const std::string &path)
     return fileStatus(path) == 1;
 }
 
-int createFile(const std::string &path)
-{
-    int fd = open(path.c_str(), O_RDONLY|O_CREAT, 0644);
-    if (fd == -1) {
-        LogError("Failed to create file: " << path << " " << GetErrnoString(errno));
-        return SECURITY_MANAGER_ERROR_FILE_CREATE_FAILED;
-    }
-    close(fd);
-    return SECURITY_MANAGER_SUCCESS;
-}
-
 int removeFile(const std::string &path)
 {
     int ret = unlink(path.c_str());
@@ -219,12 +208,6 @@ int overwriteFile(const std::string &srcPath, const std::string &dstPath) {
     return src && dst ? SECURITY_MANAGER_SUCCESS : SECURITY_MANAGER_ERROR_FILE_CREATE_FAILED;
 }
 
-int truncateFile(const std::string &path) {
-    std::ofstream dst(path, std::ios::binary|std::ios::trunc);
-    dst.close();
-    return dst ? SECURITY_MANAGER_SUCCESS : SECURITY_MANAGER_ERROR_FILE_CREATE_FAILED;
-}
-
 off_t fileSize(const std::string &path) {
     struct stat st;
     static_assert(std::is_same<off_t, decltype(st.st_size)>::value);
index 402291cd85a957a178763d8f2b3a9b60875f0d7e..2eca8080245a89afc7f640aaae136389cecb3876 100644 (file)
@@ -44,11 +44,9 @@ int createDirectory(const std::string &path);
 int removeDirectory(const std::string &path);
 int fileStatus(const std::string &path);
 bool fileExists(const std::string &path);
-int createFile(const std::string &path);
 int removeFile(const std::string &path);
 int symLink(const std::string &src, const std::string &dst);
 int overwriteFile(const std::string &src, const std::string &dst);
-int truncateFile(const std::string &path);
 off_t fileSize(const std::string &path); // < 0 on error
 
 } // namespace FS