diff options
author | Tom Cherry <tomcherry@google.com> | 2019-07-08 15:09:36 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-07-09 16:17:36 +0000 |
commit | 247ffbf3140a454fb2facf0e66ca1547e0833797 (patch) | |
tree | 4ab9a5713994334ae650f64730f939de1950e53b /init/builtins.cpp | |
parent | 0e04ce98ef9ffdba486c33589b6c0f4922c4152c (diff) |
Fix a few clang-tidy issues and add NOLINT for others
android-base:
* Add NOLINT for expanding namespace std for std::string* ostream
overload
libdm:
* Fix missing parentesis around macro parameters
init:
* Fix missing CLOEXEC usage and add NOLINT for the intended
usages.
* Fix missing parentesis around macro parameters
* Fix erase() / remove_if() idiom
* Correctly specific unsigned char when intended
* 'namespace flags' should be signed, since 'flags' it signed for
clone()
* Add clear to property restore vector<string> to empty after move
* Explicit comparison against 0 for strcmp
Test: build
Change-Id: I8c31dafda2c43ebc5aa50124cbbd6e23ed2c4101
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 55b024891..ba2c7ac2e 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -243,7 +243,7 @@ static Result<void> do_ifup(const BuiltinArguments& args) { strlcpy(ifr.ifr_name, args[1].c_str(), IFNAMSIZ); - unique_fd s(TEMP_FAILURE_RETRY(socket(AF_INET, SOCK_DGRAM, 0))); + unique_fd s(TEMP_FAILURE_RETRY(socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0))); if (s < 0) return ErrnoError() << "opening socket failed"; if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) { @@ -784,7 +784,7 @@ static Result<void> do_write(const BuiltinArguments& args) { } static Result<void> readahead_file(const std::string& filename, bool fully) { - android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filename.c_str(), O_RDONLY))); + android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filename.c_str(), O_RDONLY | O_CLOEXEC))); if (fd == -1) { return ErrnoError() << "Error opening file"; } |