Use more std::string in fastboot.
Change-Id: Ic8c77eac1e0088627ab650050d9c97c5749e5c39
diff --git a/fastboot/util_osx.cpp b/fastboot/util_osx.cpp
index ae0b024..4bae7c4 100644
--- a/fastboot/util_osx.cpp
+++ b/fastboot/util_osx.cpp
@@ -31,19 +31,15 @@
#import <Carbon/Carbon.h>
#include <unistd.h>
-void get_my_path(char s[PATH_MAX])
-{
+std::string get_my_path() {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef executableURL = CFBundleCopyExecutableURL(mainBundle);
CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
CFRelease(executableURL);
- CFStringGetFileSystemRepresentation(executablePathString, s, PATH_MAX-1);
+ char path[PATH_MAX + 1];
+ CFStringGetFileSystemRepresentation(executablePathString, path, sizeof(PATH_MAX)-1);
CFRelease(executablePathString);
- char *x;
- x = strrchr(s, '/');
- if(x) x[1] = 0;
+ return path;
}
-
-