diff options
author | Ed Maste <emaste@freebsd.org> | 2015-05-14 16:39:02 +0000 |
---|---|---|
committer | Ed Maste <emaste@freebsd.org> | 2015-05-14 16:39:02 +0000 |
commit | 31bc50698747bf73241a2feafaf8d9e338fef0d9 (patch) | |
tree | 12c6b0534b4abe1f88822842495bbe0fe5057653 | |
parent | 85a19e92d7aa9fda8246e3e571d1379ab9b9a83d (diff) | |
download | bcm5719-llvm-31bc50698747bf73241a2feafaf8d9e338fef0d9.tar.gz bcm5719-llvm-31bc50698747bf73241a2feafaf8d9e338fef0d9.zip |
Avoid Linux-specific header in platform-independent tests
llvm-svn: 237371
-rw-r--r-- | lldb/test/functionalities/process_attach/attach_denied/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/test/functionalities/process_attach/attach_denied/main.cpp b/lldb/test/functionalities/process_attach/attach_denied/main.cpp index dd23d1d4b24..b4a08d12b7e 100644 --- a/lldb/test/functionalities/process_attach/attach_denied/main.cpp +++ b/lldb/test/functionalities/process_attach/attach_denied/main.cpp @@ -2,11 +2,10 @@ #include <fcntl.h> #include <signal.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> -#include <linux/limits.h> - #include <sys/types.h> #include <sys/ptrace.h> #include <sys/stat.h> @@ -24,13 +23,14 @@ bool writePid (const char* file_name, const pid_t pid) { - char tmp_file_name[PATH_MAX]; + char *tmp_file_name = (char *)malloc(strlen(file_name) + 16); strcpy(tmp_file_name, file_name); strcat(tmp_file_name, "_tmp"); int fd = open (tmp_file_name, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); if (fd == -1) { fprintf (stderr, "open(%s) failed: %s\n", tmp_file_name, strerror (errno)); + free(tmp_file_name); return false; } char buffer[64]; @@ -49,6 +49,7 @@ bool writePid (const char* file_name, const pid_t pid) fprintf (stderr, "rename(%s, %s) failed: %s\n", tmp_file_name, file_name, strerror (errno)); res = false; } + free(tmp_file_name); return res; } |