miniscript
miniscript copied to clipboard
[C++] `file.name()` corrupts its arg
p = "a/b/"
file.name p
print "[" + p + "]" // prints: "[a/b" -- no closing "]"
Probably found the trouble maker (from man 3 basename on Linux):
Both dirname() and basename() may modify the contents of path, so it may be desirable to pass a copy when calling one of these functions.
Yes. strdup() fixed the issue on my machine.