aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2020-09-01 13:40:18 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2020-09-01 13:40:18 -0400
commit8000855e4837e9996af3423ea48be502567bc23b (patch)
tree7962b8dc0f3382d64246fe51963658042627c3d1
parent1b28a9fff5035e93c7782359e0df8b5c2d2b0f66 (diff)
downloadmultihome-8000855e4837e9996af3423ea48be502567bc23b.tar.gz
Get basename from program entrypoint instead of hardcoding the program name
-rw-r--r--multihome.c8
1 files 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);
}