Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcc8db9a authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Dumpstate: Use unique_fd

ScopedFd has been deprecated (and removed) in favor of unique_fd.

Bug: 21192156

(cherry picked from commit aff68430)

Change-Id: Ic46ca6d349bf0cc640b7d4008ac540d2c6d08568
parent e31fd642
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <unistd.h>

#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <cutils/properties.h>

#include "private/android_filesystem_config.h"
@@ -43,7 +44,6 @@
#include <cutils/log.h>

#include "dumpstate.h"
#include "ScopedFd.h"
#include "ziparchive/zip_writer.h"

#include <openssl/sha.h>
@@ -572,8 +572,8 @@ bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
}

bool add_zip_entry(const std::string& entry_name, const std::string& entry_path) {
    ScopedFd fd(TEMP_FAILURE_RETRY(open(entry_path.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC)));
    if (fd.get() == -1) {
    android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(entry_path.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC)));
    if (fd == -1) {
        MYLOGE("open(%s): %s\n", entry_path.c_str(), strerror(errno));
        return false;
    }
@@ -998,9 +998,9 @@ static bool finish_zip_file(const std::string& bugreport_name, const std::string
}

static std::string SHA256_file_hash(std::string filepath) {
    ScopedFd fd(TEMP_FAILURE_RETRY(open(filepath.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC
    android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filepath.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC
            | O_NOFOLLOW)));
    if (fd.get() == -1) {
    if (fd == -1) {
        MYLOGE("open(%s): %s\n", filepath.c_str(), strerror(errno));
        return NULL;
    }