diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-21 21:45:18 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-21 21:45:18 -0400 |
| commit | f4aaf7b73481248f6768302be688700a364a1af8 (patch) | |
| tree | 6e23e4bae1b5a0c3e359d19569627382600c4c1a /src | |
| parent | dcf266228512e100e779fe72f2d4e9ebb605ffe6 (diff) | |
Fix for getting age of compiler
Diffstat (limited to 'src')
| -rw-r--r-- | src/tomo.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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)) |
