summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stephen Hines <srhines@google.com> 2019-05-09 13:03:40 -0700
committer Stephen Hines <srhines@google.com> 2019-05-09 13:11:59 -0700
commit6896f0626b05a76b3db7d98be79cb87b0953b7e2 (patch)
tree5e97bcf64a35d6f33081cf0dc8ea5a5e99884079
parent67923215feba2cf61551dc5121012261a5728ac2 (diff)
NFC: Directly initialize the 's' variable.
As part of enabling -Wconditional-uninitialized, there are some false positives. See https://bugs.llvm.org/show_bug.cgi?id=38856 for more info about the limited flow analysis. To facilitate turning this flag on more widely, we can just directly initialize these variables. Bug: http://b/131390872 Test: Builds with -Wconditional-uninitialized. Change-Id: Id6633a06478dfb0c51a1a3b0cabf4c4e5d57abaa
-rw-r--r--cmds/bugreport/bugreport.cpp2
-rw-r--r--cmds/bugreportz/main.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/cmds/bugreport/bugreport.cpp b/cmds/bugreport/bugreport.cpp
index 917c8132b7..840ae473bc 100644
--- a/cmds/bugreport/bugreport.cpp
+++ b/cmds/bugreport/bugreport.cpp
@@ -37,7 +37,7 @@ int main() {
property_set("ctl.start", "dumpstate");
// Socket will not be available until service starts.
- int s;
+ int s = -1;
for (int i = 0; i < 20; i++) {
s = socket_local_client("dumpstate", ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_STREAM);
diff --git a/cmds/bugreportz/main.cpp b/cmds/bugreportz/main.cpp
index a3ae1ffa4d..945eae50af 100644
--- a/cmds/bugreportz/main.cpp
+++ b/cmds/bugreportz/main.cpp
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
property_set("ctl.start", "dumpstatez");
// Socket will not be available until service starts.
- int s;
+ int s = -1;
for (int i = 0; i < 20; i++) {
s = socket_local_client("dumpstate", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM);
if (s >= 0) break;