diff options
author | Elliott Hughes <enh@google.com> | 2017-02-22 17:31:41 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-02-22 17:37:52 -0800 |
commit | 30a36273ab761fb07892f7816b4873b6c48a0cea (patch) | |
tree | 98b9470ffdf08c56244bb66f2e595d8fda498ede /linker/linker_logger.cpp | |
parent | c9a840ac76c7cdbe6028ac91cdb8eb6698f0a854 (diff) |
Cope with argv[0] being null in the dynamic linker.
Somewhat unsurprisingly, very few commands are happy to be run like this,
in particular multiplexed commands like toybox. But that's no reason for
the linker to get in the way too.
Bug: http://b/33276926
Test: new test
Change-Id: I6dd71ea0183f4da83571039c2198ebb6ed38520e
Diffstat (limited to 'linker/linker_logger.cpp')
-rw-r--r-- | linker/linker_logger.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/linker/linker_logger.cpp b/linker/linker_logger.cpp index 08728afbb..b2ea320ea 100644 --- a/linker/linker_logger.cpp +++ b/linker/linker_logger.cpp @@ -85,13 +85,20 @@ void LinkerLogger::ResetState() { } flags_ = 0; - // check flag applied to all processes first + + // Check flag applied to all processes first. std::string value = property_get(kSystemLdDebugProperty); flags_ |= ParseProperty(value); - // get process basename + // Ignore processes started without argv (http://b/33276926). + if (g_argv[0] == nullptr) { + return; + } + + // Get process basename. const char* process_name_start = basename(g_argv[0]); - // remove ':' and everything after it. This is naming convention for + + // Remove ':' and everything after it. This is the naming convention for // services: https://developer.android.com/guide/components/services.html const char* process_name_end = strchr(process_name_start, ':'); |