From 3fd262c6f85f5e6ef0ad0e9539e0d01cb3ce82bb Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Thu, 6 Sep 2012 07:52:22 +0930 Subject: [PATCH] Add Solaris method for getting executable path & make the compiler bail out if there is no method available rather than waiting until runtime. --- log.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/log.c b/log.c index 378754d9..de0fc0f2 100644 --- a/log.c +++ b/log.c @@ -386,16 +386,16 @@ ssize_t read_symlink(const char *path, char *buf, size_t len) ssize_t get_self_executable_path(char *buf, size_t len) { -#ifdef linux +#if defined(linux) return read_symlink("/proc/self/exe", buf, len); -#endif -#ifdef __APPLE__ - // Mac OS X - // TODO: Not tested +#elif defined (__sun__) + return read_symlink("/proc/self/path/a.out", buf, len); +#elif defined (__APPLE__) uint32_t bufsize = len; return _NSGetExecutablePath(buf, &bufsize) == -1 && len ? -1 : bufsize; +#else +#error Unable to find executable path #endif - return WHYF("Not implemented"); } int log_backtrace(struct __sourceloc where)