mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-20 23:55:24 -04:00
!33 【OpenHarmony】【轻量级应用程序框架子系统】bms存储文件时增加fsync
Merge pull request !33 from wangdengjia/070202
This commit is contained in:
@@ -142,6 +142,7 @@ bool BundleFileUtils::WriteFile(const char *file, const void *buffer, uint32_t s
|
||||
return false;
|
||||
}
|
||||
|
||||
fsync(fp);
|
||||
close(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
|
||||
#include "extractor_util.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
@@ -62,6 +66,10 @@ bool ExtractorUtil::ExtractFileToPath(const std::string &filePath, const std::st
|
||||
}
|
||||
fileStream.clear();
|
||||
fileStream.close();
|
||||
|
||||
int fd = open(filePath.c_str(), O_RDWR, S_IRUSR | S_IWUSR);
|
||||
fsync(fd);
|
||||
close(fd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user