From 8000855e4837e9996af3423ea48be502567bc23b Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 1 Sep 2020 13:40:18 -0400 Subject: Get basename from program entrypoint instead of hardcoding the program name --- multihome.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/multihome.c b/multihome.c index c553cc0..18fe413 100644 --- a/multihome.c +++ b/multihome.c @@ -295,13 +295,17 @@ void write_init_script() { char buf[PATH_MAX]; char date[100]; char *path; + char *entry_point; struct tm *tm; time_t now; FILE *fp; - path = find_program("multihome"); + strcpy(buf, multihome.entry_point); + entry_point = basename(buf); + + path = find_program(entry_point); if (path == NULL) { - fprintf(stderr, "multihome not found on $PATH"); + fprintf(stderr, "%s not found on $PATH\n", buf); exit(1); } -- cgit