diff options
Diffstat (limited to 'base/logging.cpp')
-rw-r--r-- | base/logging.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/base/logging.cpp b/base/logging.cpp index d60d91d5d..bd09069a0 100644 --- a/base/logging.cpp +++ b/base/logging.cpp @@ -53,6 +53,7 @@ #include <unistd.h> #endif +#include <android-base/file.h> #include <android-base/macros.h> #include <android-base/parseint.h> #include <android-base/strings.h> @@ -71,14 +72,8 @@ static const char* getprogname() { static char progname[MAX_PATH] = {}; if (first) { - CHAR longname[MAX_PATH]; - DWORD nchars = GetModuleFileNameA(nullptr, longname, arraysize(longname)); - if ((nchars >= arraysize(longname)) || (nchars == 0)) { - // String truncation or some other error. - strcpy(progname, "<unknown>"); - } else { - strcpy(progname, basename(longname)); - } + snprintf(progname, sizeof(progname), "%s", + android::base::Basename(android::base::GetExecutablePath()).c_str()); first = false; } |