Merge "fix some liblp file access for win32"
This commit is contained in:
commit
5dbd893784
1 changed files with 4 additions and 4 deletions
|
|
@ -124,7 +124,7 @@ bool WriteToImageFile(borrowed_fd fd, const LpMetadata& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WriteToImageFile(const std::string& file, const LpMetadata& input) {
|
bool WriteToImageFile(const std::string& file, const LpMetadata& input) {
|
||||||
unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC, 0644));
|
unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_BINARY, 0644));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
PERROR << __PRETTY_FUNCTION__ << " open failed: " << file;
|
PERROR << __PRETTY_FUNCTION__ << " open failed: " << file;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -184,7 +184,7 @@ bool ImageBuilder::IsValid() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImageBuilder::Export(const std::string& file) {
|
bool ImageBuilder::Export(const std::string& file) {
|
||||||
unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC, 0644));
|
unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_BINARY, 0644));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
PERROR << "open failed: " << file;
|
PERROR << "open failed: " << file;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -208,7 +208,7 @@ bool ImageBuilder::ExportFiles(const std::string& output_dir) {
|
||||||
std::string file_name = "super_" + name + ".img";
|
std::string file_name = "super_" + name + ".img";
|
||||||
std::string file_path = output_dir + "/" + file_name;
|
std::string file_path = output_dir + "/" + file_name;
|
||||||
|
|
||||||
static const int kOpenFlags = O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_NOFOLLOW;
|
static const int kOpenFlags = O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
|
||||||
unique_fd fd(open(file_path.c_str(), kOpenFlags, 0644));
|
unique_fd fd(open(file_path.c_str(), kOpenFlags, 0644));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
PERROR << "open failed: " << file_path;
|
PERROR << "open failed: " << file_path;
|
||||||
|
|
@ -443,7 +443,7 @@ bool ImageBuilder::CheckExtentOrdering() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImageBuilder::OpenImageFile(const std::string& file) {
|
int ImageBuilder::OpenImageFile(const std::string& file) {
|
||||||
android::base::unique_fd source_fd = GetControlFileOrOpen(file.c_str(), O_RDONLY | O_CLOEXEC);
|
unique_fd source_fd = GetControlFileOrOpen(file.c_str(), O_RDONLY | O_CLOEXEC | O_BINARY);
|
||||||
if (source_fd < 0) {
|
if (source_fd < 0) {
|
||||||
PERROR << "open image file failed: " << file;
|
PERROR << "open image file failed: " << file;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue