aboutsummaryrefslogtreecommitdiff
path: root/src/tomo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tomo.c')
-rw-r--r--src/tomo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tomo.c b/src/tomo.c
index e99f42d9..93381f2f 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -87,7 +87,12 @@ int main(int argc, char *argv[])
{
// Get the file modification time of the compiler, so we
// can recompile files after changing the compiler:
- if (stat(argv[0], &compiler_stat) != 0)
+ char compiler_path[PATH_MAX];
+ ssize_t count = readlink("/proc/self/exe", compiler_path, PATH_MAX);
+ if (count == -1)
+ err(1, "Could not find age of compiler");
+ compiler_path[count] = '\0';
+ if (stat(compiler_path, &compiler_stat) != 0)
err(1, "Could not find age of compiler");
if (register_printf_specifier('T', printf_type, printf_pointer_size))