[PATCH] D46518: LLDB - Simplify GetProgramFileSpec
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 7 04:02:03 PDT 2018
devnexen created this revision.
devnexen added a reviewer: zturner.
Herald added subscribers: llvm-commits, emaste.
Repository:
rL LLVM
https://reviews.llvm.org/D46518
Files:
source/Host/freebsd/HostInfoFreeBSD.cpp
Index: source/Host/freebsd/HostInfoFreeBSD.cpp
===================================================================
--- source/Host/freebsd/HostInfoFreeBSD.cpp
+++ source/Host/freebsd/HostInfoFreeBSD.cpp
@@ -64,13 +64,10 @@
static FileSpec g_program_filespec;
if (!g_program_filespec) {
int exe_path_mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid()};
- size_t exe_path_size;
- if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0) {
- char *exe_path = new char[exe_path_size];
- if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
- g_program_filespec.SetFile(exe_path, false);
- delete[] exe_path;
- }
+ char exe_path[PATH_MAX];
+ size_t exe_path_size = sizeof(exe_path);
+ if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
+ g_program_filespec.SetFile(exe_path, false);
}
return g_program_filespec;
-}
\ No newline at end of file
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46518.145443.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/4501c5d8/attachment.bin>
More information about the llvm-commits
mailing list