Skip to content

Commit 88efbdf

Browse files
committed
path_append now check both path and filename for '/'
1 parent 25b2389 commit 88efbdf

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
char *path_append(const char *path, const char *filename)
88
{
99
int needs_separator = 0;
10-
if (path[strnlen(path, MAX_PATH_LEN)-1] != '/') {
10+
if ((path[strnlen(path, MAX_PATH_LEN)-1] != '/') && (filename[0] != '/')) {
1111
needs_separator = 1;
1212
}
1313

src/util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* \brief append a path
2222
* \details This function appends a path with the next level, while taking the
2323
* trailing slash of the upper level into account.
24+
*
25+
* Please free the char * pointer after use.
2426
*/
2527
char *path_append(const char *path, const char *filename);
2628

0 commit comments

Comments
 (0)