Brad Bishop | 0f291cc | 2019-09-01 15:16:57 -0400 | [diff] [blame^] | 1 | From c817db76bb63b872fe2069e3c2449ac18affe8c1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 30 Aug 2019 13:17:38 -0700 |
| 4 | Subject: [PATCH] replace canonicalize_file_name with realpath |
| 5 | |
| 6 | Use 'realpath()' (BSD, POSIX) instead of |
| 7 | 'canonicalize_file_name()' (GNU extension). |
| 8 | |
| 9 | Fixes |
| 10 | error: use of undeclared identifier 'canonicalize_file_name' |
| 11 | |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | --- |
| 14 | lib/engine/filesystem.cpp | 2 +- |
| 15 | tools/ssieventmonitor.cpp | 2 +- |
| 16 | 2 files changed, 2 insertions(+), 2 deletions(-) |
| 17 | |
| 18 | diff --git a/lib/engine/filesystem.cpp b/lib/engine/filesystem.cpp |
| 19 | index bf5a776..194ab8a 100644 |
| 20 | --- a/lib/engine/filesystem.cpp |
| 21 | +++ b/lib/engine/filesystem.cpp |
| 22 | @@ -54,7 +54,7 @@ void CanonicalPath::__canonicalize_path_name(const char *path) |
| 23 | if (path == NULL) { |
| 24 | throw E_NULL_POINTER; |
| 25 | } |
| 26 | - char *p = canonicalize_file_name(path); |
| 27 | + char *p = realpath(path, (char *)0); |
| 28 | assign(p); |
| 29 | if (p) { |
| 30 | free(p); |
| 31 | diff --git a/tools/ssieventmonitor.cpp b/tools/ssieventmonitor.cpp |
| 32 | index 80791fd..3eed877 100644 |
| 33 | --- a/tools/ssieventmonitor.cpp |
| 34 | +++ b/tools/ssieventmonitor.cpp |
| 35 | @@ -120,7 +120,7 @@ static int _exec_ssimsg(void) |
| 36 | int status; |
| 37 | switch (pid) { |
| 38 | case 0: { |
| 39 | - cp = canonicalize_file_name("/proc/self/exe"); |
| 40 | + cp = realpath("/proc/self/exe", (char *)0); |
| 41 | if (cp) { |
| 42 | strcpy_s(buffer, sizeof(buffer), cp); |
| 43 | free(cp); |