diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-09-03 09:31:37 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-09-03 09:31:37 -0400 |
commit | ea1c91fa18cb00205389a0167606ff712bbb6d1b (patch) | |
tree | 0f81635a68b20b4aed8eafa857b6926b38df8222 | |
parent | b10833eafe987234b5da51051400a0e515e54146 (diff) | |
download | multihome-ea1c91fa18cb00205389a0167606ff712bbb6d1b.tar.gz |
Clean up find_program
-rw-r--r-- | multihome.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/multihome.c b/multihome.c index 12fc41a..a2f78a4 100644 --- a/multihome.c +++ b/multihome.c @@ -313,20 +313,22 @@ void write_init_script() { char buf[PATH_MAX]; char date[100]; char *path; - char *entry_point; struct tm *tm; time_t now; FILE *fp; + // Populate buf with the program's argv[0] record strcpy(buf, multihome.entry_point); - entry_point = basename(buf); - path = find_program(entry_point); + // Find the program's system path + path = find_program(buf); if (path == NULL) { fprintf(stderr, "%s not found on $PATH\n", buf); exit(1); } + // Clear buf and store the updated path + memset(buf, '\0', sizeof(buf)); strcpy(buf, path); // Open init script for writing |