From 0813a911a58763a2473eab402ce1c8d3a2658fe0 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 10 Aug 2021 17:27:16 +1000 Subject: Cleanly symlink the executable by removing it if it exists already. --- src/sledjchisl/sledjchisl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/sledjchisl') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 405da6a..ca2927e 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -7700,6 +7700,12 @@ jit library is loaded or the JIT compiler will not be activated. char *newPath = xmprintf("%s/current/bin/sledjchisl", scRoot); tmp = xmprintf("%s/sledjchisl", scBin); I("Symlinking %s to %s", newPath, tmp); + if (qfile_exist(tmp)) + { + snprintf(toybuf, sizeof(toybuf), "rm %s", tmp); + if (!WIFEXITED(system(toybuf))) + E("rm command failed!"); + } if (0 != symlink(newPath, tmp)) perror_msg("Symlinking %s to %s", newPath, tmp); free(tmp); -- cgit v1.1