opnsense-ports/cad/openvsp/files/patch-src_util_FileUtil.cpp
Franco Fichtner 86637a1fa4 */*: sync with upstream
Taken from: HardenedBSD
2019-04-06 09:24:22 +02:00

31 lines
592 B
C++

--- src/util/FileUtil.cpp.orig 2019-03-28 20:30:27 UTC
+++ src/util/FileUtil.cpp
@@ -19,7 +19,9 @@
#include <pwd.h>
#endif
+#include <libgen.h>
+
vector< string > ScanFolder( const char* dir_path )
{
vector< string > file_vec;
@@ -107,9 +109,18 @@ bail:
string PathToExe()
{
+
int bufsize = 255;
char *path = NULL;
bool done = false;
+
+ char temp[PATH_MAX];
+ char exepath[PATH_MAX];
+
+ ::snprintf(temp, sizeof(temp),"/proc/curproc/file");
+ ::realpath(temp, exepath);
+
+ return dirname(exepath);
// Pre-loop initialization.
#ifdef WIN32