From 4edd651ed32ba3f09ace7529b5fb85f46cae508f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 3 Oct 2016 16:46:33 -0700 Subject: [PATCH] Add missing O_CLOEXEC and TEMP_FAILURE_RETRY to localtime.c. Follow-on change from http://b/31848040. Test: *time* tests. Change-Id: I3f1c9ce19b90f6f8c1ac6e0753e3fed0ff63c0b4 --- libc/tzcode/localtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c index 6e888193c..74411f767 100644 --- a/libc/tzcode/localtime.c +++ b/libc/tzcode/localtime.c @@ -426,7 +426,7 @@ tzloadbody(char const *name, struct state *sp, bool doextend, return errno; #if defined(__BIONIC__) - nread = read(fid, up->buf, entry_length); + nread = TEMP_FAILURE_RETRY(read(fid, up->buf, entry_length)); #else nread = read(fid, up->buf, sizeof up->buf); #endif @@ -2361,7 +2361,7 @@ static int __bionic_open_tzdata_path(const char* path_prefix_variable, const cha return -1; } snprintf(path, path_length, "%s/%s", path_prefix, path_suffix); - int fd = TEMP_FAILURE_RETRY(open(path, OPEN_MODE)); + int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC)); if (fd == -1) { free(path); return -2; // Distinguish failure to find any data from failure to find a specific id. -- 2.11.0