Loading base/file.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,7 @@ bool ReadFileToString(const std::string& path, std::string* content) { return false; return false; } } bool result = ReadFdToString(fd, content); bool result = ReadFdToString(fd, content); TEMP_FAILURE_RETRY(close(fd)); close(fd); return result; return result; } } Loading Loading @@ -102,7 +102,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path, ALOGE("android::WriteStringToFile write failed: %s", strerror(errno)); ALOGE("android::WriteStringToFile write failed: %s", strerror(errno)); return CleanUpAfterFailedWrite(path); return CleanUpAfterFailedWrite(path); } } TEMP_FAILURE_RETRY(close(fd)); close(fd); return true; return true; } } #endif #endif Loading @@ -116,7 +116,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path) { } } bool result = WriteStringToFd(content, fd); bool result = WriteStringToFd(content, fd); TEMP_FAILURE_RETRY(close(fd)); close(fd); return result || CleanUpAfterFailedWrite(path); return result || CleanUpAfterFailedWrite(path); } } Loading debuggerd/debuggerd.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -279,7 +279,7 @@ static bool is32bit(pid_t tid) { char ehdr[EI_NIDENT]; char ehdr[EI_NIDENT]; ssize_t bytes = TEMP_FAILURE_RETRY(read(fd, &ehdr, sizeof(ehdr))); ssize_t bytes = TEMP_FAILURE_RETRY(read(fd, &ehdr, sizeof(ehdr))); TEMP_FAILURE_RETRY(close(fd)); close(fd); if (bytes != (ssize_t) sizeof(ehdr) || memcmp(ELFMAG, ehdr, SELFMAG) != 0) { if (bytes != (ssize_t) sizeof(ehdr) || memcmp(ELFMAG, ehdr, SELFMAG) != 0) { return false; return false; } } Loading @@ -304,14 +304,14 @@ static void redirect_to_32(int fd, debugger_request_t* request) { if (TEMP_FAILURE_RETRY(write(sock_fd, &msg, sizeof(msg))) != (ssize_t) sizeof(msg)) { if (TEMP_FAILURE_RETRY(write(sock_fd, &msg, sizeof(msg))) != (ssize_t) sizeof(msg)) { ALOGE("Failed to write request to debuggerd32 socket: %s", strerror(errno)); ALOGE("Failed to write request to debuggerd32 socket: %s", strerror(errno)); TEMP_FAILURE_RETRY(close(sock_fd)); close(sock_fd); return; return; } } char ack; char ack; if (TEMP_FAILURE_RETRY(read(sock_fd, &ack, 1)) == -1) { if (TEMP_FAILURE_RETRY(read(sock_fd, &ack, 1)) == -1) { ALOGE("Failed to read ack from debuggerd32 socket: %s", strerror(errno)); ALOGE("Failed to read ack from debuggerd32 socket: %s", strerror(errno)); TEMP_FAILURE_RETRY(close(sock_fd)); close(sock_fd); return; return; } } Loading @@ -338,7 +338,7 @@ static void redirect_to_32(int fd, debugger_request_t* request) { break; break; } } } } TEMP_FAILURE_RETRY(close(sock_fd)); close(sock_fd); } } #endif #endif Loading @@ -365,7 +365,7 @@ static void handle_request(int fd) { ALOGE("debuggerd: Not allowed to redirect action %d to 32 bit debuggerd\n", ALOGE("debuggerd: Not allowed to redirect action %d to 32 bit debuggerd\n", request.action); request.action); } } TEMP_FAILURE_RETRY(close(fd)); close(fd); return; return; } } #endif #endif Loading fs_mgr/fs_mgr.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -203,7 +203,7 @@ int fs_mgr_set_blk_ro(const char *blockdev) } } rc = ioctl(fd, BLKROSET, &ON); rc = ioctl(fd, BLKROSET, &ON); TEMP_FAILURE_RETRY(close(fd)); close(fd); return rc; return rc; } } Loading fs_mgr/fs_mgr_verity.c +9 −9 Original line number Original line Diff line number Diff line Loading @@ -169,20 +169,20 @@ static int ext4_get_target_device_size(char *blk_device, uint64_t *device_size) if (TEMP_FAILURE_RETRY(lseek64(data_device, 1024, SEEK_SET)) < 0) { if (TEMP_FAILURE_RETRY(lseek64(data_device, 1024, SEEK_SET)) < 0) { ERROR("Error seeking to superblock"); ERROR("Error seeking to superblock"); TEMP_FAILURE_RETRY(close(data_device)); close(data_device); return -1; return -1; } } if (TEMP_FAILURE_RETRY(read(data_device, &sb, sizeof(sb))) != sizeof(sb)) { if (TEMP_FAILURE_RETRY(read(data_device, &sb, sizeof(sb))) != sizeof(sb)) { ERROR("Error reading superblock"); ERROR("Error reading superblock"); TEMP_FAILURE_RETRY(close(data_device)); close(data_device); return -1; return -1; } } ext4_parse_sb(&sb, &info); ext4_parse_sb(&sb, &info); *device_size = info.len; *device_size = info.len; TEMP_FAILURE_RETRY(close(data_device)); close(data_device); return 0; return 0; } } Loading Loading @@ -301,7 +301,7 @@ static int read_verity_metadata(uint64_t device_size, char *block_device, char * out: out: if (device != -1) if (device != -1) TEMP_FAILURE_RETRY(close(device)); close(device); if (retval != FS_MGR_SETUP_VERITY_SUCCESS) { if (retval != FS_MGR_SETUP_VERITY_SUCCESS) { free(*signature); free(*signature); Loading Loading @@ -470,7 +470,7 @@ static int check_verity_restart(const char *fname) out: out: if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -622,7 +622,7 @@ static int write_verity_state(const char *fname, off64_t offset, int32_t mode) out: out: if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -670,7 +670,7 @@ static int read_verity_state(const char *fname, off64_t offset, int *mode) out: out: if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -745,7 +745,7 @@ out: free(signature); free(signature); if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -913,7 +913,7 @@ out: } } if (fd) { if (fd) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading init/util.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -171,7 +171,7 @@ bool read_file(const char* path, std::string* content) { } } bool okay = android::base::ReadFdToString(fd, content); bool okay = android::base::ReadFdToString(fd, content); TEMP_FAILURE_RETRY(close(fd)); close(fd); return okay; return okay; } } Loading @@ -185,7 +185,7 @@ int write_file(const char* path, const char* content) { if (result == -1) { if (result == -1) { NOTICE("write_file: Unable to write to '%s': %s\n", path, strerror(errno)); NOTICE("write_file: Unable to write to '%s': %s\n", path, strerror(errno)); } } TEMP_FAILURE_RETRY(close(fd)); close(fd); return result; return result; } } Loading Loading
base/file.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,7 @@ bool ReadFileToString(const std::string& path, std::string* content) { return false; return false; } } bool result = ReadFdToString(fd, content); bool result = ReadFdToString(fd, content); TEMP_FAILURE_RETRY(close(fd)); close(fd); return result; return result; } } Loading Loading @@ -102,7 +102,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path, ALOGE("android::WriteStringToFile write failed: %s", strerror(errno)); ALOGE("android::WriteStringToFile write failed: %s", strerror(errno)); return CleanUpAfterFailedWrite(path); return CleanUpAfterFailedWrite(path); } } TEMP_FAILURE_RETRY(close(fd)); close(fd); return true; return true; } } #endif #endif Loading @@ -116,7 +116,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path) { } } bool result = WriteStringToFd(content, fd); bool result = WriteStringToFd(content, fd); TEMP_FAILURE_RETRY(close(fd)); close(fd); return result || CleanUpAfterFailedWrite(path); return result || CleanUpAfterFailedWrite(path); } } Loading
debuggerd/debuggerd.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -279,7 +279,7 @@ static bool is32bit(pid_t tid) { char ehdr[EI_NIDENT]; char ehdr[EI_NIDENT]; ssize_t bytes = TEMP_FAILURE_RETRY(read(fd, &ehdr, sizeof(ehdr))); ssize_t bytes = TEMP_FAILURE_RETRY(read(fd, &ehdr, sizeof(ehdr))); TEMP_FAILURE_RETRY(close(fd)); close(fd); if (bytes != (ssize_t) sizeof(ehdr) || memcmp(ELFMAG, ehdr, SELFMAG) != 0) { if (bytes != (ssize_t) sizeof(ehdr) || memcmp(ELFMAG, ehdr, SELFMAG) != 0) { return false; return false; } } Loading @@ -304,14 +304,14 @@ static void redirect_to_32(int fd, debugger_request_t* request) { if (TEMP_FAILURE_RETRY(write(sock_fd, &msg, sizeof(msg))) != (ssize_t) sizeof(msg)) { if (TEMP_FAILURE_RETRY(write(sock_fd, &msg, sizeof(msg))) != (ssize_t) sizeof(msg)) { ALOGE("Failed to write request to debuggerd32 socket: %s", strerror(errno)); ALOGE("Failed to write request to debuggerd32 socket: %s", strerror(errno)); TEMP_FAILURE_RETRY(close(sock_fd)); close(sock_fd); return; return; } } char ack; char ack; if (TEMP_FAILURE_RETRY(read(sock_fd, &ack, 1)) == -1) { if (TEMP_FAILURE_RETRY(read(sock_fd, &ack, 1)) == -1) { ALOGE("Failed to read ack from debuggerd32 socket: %s", strerror(errno)); ALOGE("Failed to read ack from debuggerd32 socket: %s", strerror(errno)); TEMP_FAILURE_RETRY(close(sock_fd)); close(sock_fd); return; return; } } Loading @@ -338,7 +338,7 @@ static void redirect_to_32(int fd, debugger_request_t* request) { break; break; } } } } TEMP_FAILURE_RETRY(close(sock_fd)); close(sock_fd); } } #endif #endif Loading @@ -365,7 +365,7 @@ static void handle_request(int fd) { ALOGE("debuggerd: Not allowed to redirect action %d to 32 bit debuggerd\n", ALOGE("debuggerd: Not allowed to redirect action %d to 32 bit debuggerd\n", request.action); request.action); } } TEMP_FAILURE_RETRY(close(fd)); close(fd); return; return; } } #endif #endif Loading
fs_mgr/fs_mgr.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -203,7 +203,7 @@ int fs_mgr_set_blk_ro(const char *blockdev) } } rc = ioctl(fd, BLKROSET, &ON); rc = ioctl(fd, BLKROSET, &ON); TEMP_FAILURE_RETRY(close(fd)); close(fd); return rc; return rc; } } Loading
fs_mgr/fs_mgr_verity.c +9 −9 Original line number Original line Diff line number Diff line Loading @@ -169,20 +169,20 @@ static int ext4_get_target_device_size(char *blk_device, uint64_t *device_size) if (TEMP_FAILURE_RETRY(lseek64(data_device, 1024, SEEK_SET)) < 0) { if (TEMP_FAILURE_RETRY(lseek64(data_device, 1024, SEEK_SET)) < 0) { ERROR("Error seeking to superblock"); ERROR("Error seeking to superblock"); TEMP_FAILURE_RETRY(close(data_device)); close(data_device); return -1; return -1; } } if (TEMP_FAILURE_RETRY(read(data_device, &sb, sizeof(sb))) != sizeof(sb)) { if (TEMP_FAILURE_RETRY(read(data_device, &sb, sizeof(sb))) != sizeof(sb)) { ERROR("Error reading superblock"); ERROR("Error reading superblock"); TEMP_FAILURE_RETRY(close(data_device)); close(data_device); return -1; return -1; } } ext4_parse_sb(&sb, &info); ext4_parse_sb(&sb, &info); *device_size = info.len; *device_size = info.len; TEMP_FAILURE_RETRY(close(data_device)); close(data_device); return 0; return 0; } } Loading Loading @@ -301,7 +301,7 @@ static int read_verity_metadata(uint64_t device_size, char *block_device, char * out: out: if (device != -1) if (device != -1) TEMP_FAILURE_RETRY(close(device)); close(device); if (retval != FS_MGR_SETUP_VERITY_SUCCESS) { if (retval != FS_MGR_SETUP_VERITY_SUCCESS) { free(*signature); free(*signature); Loading Loading @@ -470,7 +470,7 @@ static int check_verity_restart(const char *fname) out: out: if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -622,7 +622,7 @@ static int write_verity_state(const char *fname, off64_t offset, int32_t mode) out: out: if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -670,7 +670,7 @@ static int read_verity_state(const char *fname, off64_t offset, int *mode) out: out: if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -745,7 +745,7 @@ out: free(signature); free(signature); if (fd != -1) { if (fd != -1) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading Loading @@ -913,7 +913,7 @@ out: } } if (fd) { if (fd) { TEMP_FAILURE_RETRY(close(fd)); close(fd); } } return rc; return rc; Loading
init/util.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -171,7 +171,7 @@ bool read_file(const char* path, std::string* content) { } } bool okay = android::base::ReadFdToString(fd, content); bool okay = android::base::ReadFdToString(fd, content); TEMP_FAILURE_RETRY(close(fd)); close(fd); return okay; return okay; } } Loading @@ -185,7 +185,7 @@ int write_file(const char* path, const char* content) { if (result == -1) { if (result == -1) { NOTICE("write_file: Unable to write to '%s': %s\n", path, strerror(errno)); NOTICE("write_file: Unable to write to '%s': %s\n", path, strerror(errno)); } } TEMP_FAILURE_RETRY(close(fd)); close(fd); return result; return result; } } Loading