Skip to content

Commit

Permalink
refactoring: small improvement of make_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
rhash committed Jul 23, 2014
1 parent 8c913f8 commit b599d7d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions common_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ char* make_path(const char* dir_path, const char* filename)
/* remove leading path separators from filename */
while(IS_PATH_SEPARATOR(*filename)) filename++;

if (dir_path[0] == '.' && dir_path[1] == 0) {
/* do not extend filename for dir_path="." */
return rsh_strdup(filename);
}

/* copy directory path */
len = strlen(dir_path);
buf = (char*)rsh_malloc(len + strlen(filename) + 2);
Expand Down

0 comments on commit b599d7d

Please sign in to comment.