summaryrefslogtreecommitdiffstats
path: root/02_exercise/prompt_utils.c
diff options
context:
space:
mode:
Diffstat (limited to '02_exercise/prompt_utils.c')
-rw-r--r--02_exercise/prompt_utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/02_exercise/prompt_utils.c b/02_exercise/prompt_utils.c
index b7c836b..d43a6b6 100644
--- a/02_exercise/prompt_utils.c
+++ b/02_exercise/prompt_utils.c
@@ -58,7 +58,7 @@ char const *relative_path(char const *const from_dir, char const *const to_dir)
} else {
char const *const go_up = "/..";
size_t length = strlen(to_dir + common_position) + strlen("..") +
- strlen(go_up) * (levels_up - 1);
+ strlen(go_up) * (levels_up - 1) + 1;
return_value = malloc(length * sizeof(char));
strcpy(return_value, "..");
for (size_t j = 0; j < levels_up - 1; ++j) {