fix(initsystem): avoid mutating path buffer with POSIX basename
This commit is contained in:
1 parent
c6c8bffbab
commit
2b299cf97a
1 file changed
+3
-1
@@ -39,8 +39,10 @@ const char* ffDetectInitSystem(FFInitSystemResult* result) {
|
||||
// In some old system, /sbin/init is a symlink
|
||||
char buf[PATH_MAX];
|
||||
if (realpath(result->exe.chars, buf)) {
|
||||
char baseBuf[PATH_MAX];
|
||||
ffStrCopy(baseBuf, buf, sizeof(baseBuf));
|
||||
ffStrbufSetS(&result->name, basename(baseBuf));
|
||||
ffStrbufSetS(&result->exe, buf);
|
||||
ffStrbufSetS(&result->name, basename(result->exe.chars));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user