fix claiming on macOS (#16686)
Ilya Mashchenko committed
Dec 29, 2023 at 03:50 UTC
e97a607a6c984b00ca720ca495c306b0b517c572
1 file changed
+4
-2
daemon/daemon.c
+4
-2
@@ -27,8 +27,10 @@ void get_netdata_execution_path(void) {
27
28
netdata_exe_file[exepath_size] = '\0';
29
30
- strcpy(netdata_exe_path, netdata_exe_file);
31
- dirname(netdata_exe_path);
30
+ // macOS's dirname(3) does not modify passed string
31
+ char *tmpdir = strdupz(netdata_exe_file);
32
+ strcpy(netdata_exe_path, dirname(tmpdir));
33
+ freez(tmpdir);
34
}
35
36
static void fix_directory_file_permissions(const char *dirname, uid_t uid, gid_t gid, bool recursive)