diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2019-03-29 21:41:14 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2019-03-29 21:41:14 +0000 |
commit | 33d7e3ee781b9ac620b4a49c472c63948e51b08c (patch) | |
tree | 06bf5caaf3455a2d6f3dee5149d7143cb541aa5a /openat.cc | |
parent | e5a5dd6cc488f19e182ad3f694957389e4a7d40a (diff) |
Notes
Diffstat (limited to 'openat.cc')
-rw-r--r-- | openat.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/openat.cc b/openat.cc index c35630bd60aa..ca7e39772f9a 100644 --- a/openat.cc +++ b/openat.cc @@ -11,9 +11,9 @@ // Check an open call works and close the resulting fd. #define EXPECT_OPEN_OK(f) do { \ - int fd = f; \ - EXPECT_OK(fd); \ - close(fd); \ + int _fd = f; \ + EXPECT_OK(_fd); \ + close(_fd); \ } while (0) static void CreateFile(const char *filename, const char *contents) { @@ -176,10 +176,14 @@ class OpenatTest : public ::testing::Test { // Create a couple of nested directories int rc = mkdir(TmpFile(TOPDIR), 0755); EXPECT_OK(rc); - if (rc < 0) EXPECT_EQ(EEXIST, errno); + if (rc < 0) { + EXPECT_EQ(EEXIST, errno); + } rc = mkdir(TmpFile(SUBDIR_ABS), 0755); EXPECT_OK(rc); - if (rc < 0) EXPECT_EQ(EEXIST, errno); + if (rc < 0) { + EXPECT_EQ(EEXIST, errno); + } // Figure out a path prefix (like "../..") that gets us to the root // directory from TmpFile(TOPDIR). |