diff options
| author | verdant <im@verdant.ee> | 2026-07-27 20:46:24 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-07-27 20:46:24 +0800 |
| commit | f41e008bbb9d9cd652c3e676f3ae7cc19d4df80f (patch) | |
| tree | 04d7748d497671e0eea6e8e390f8eb91399e470b | |
| parent | 858dc29b751531f92c285c990206083b89790de2 (diff) | |
| download | sf-f41e008bbb9d9cd652c3e676f3ae7cc19d4df80f.tar.gz sf-f41e008bbb9d9cd652c3e676f3ae7cc19d4df80f.zip | |
Fix path normalization in path_normalize()
| -rw-r--r-- | main.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -25,9 +25,17 @@ static void path_normalize(char *path) { - if (path == NULL) + if (!path) return; - realpath(path, path); + + char new_path[PATH_MAX]; + if (realpath(path, new_path)) { + path = new_path; + } else { + return; + } + + return; } int main(int argc, char **argv) |
