summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-07-31 17:34:40 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-07-31 17:34:40 -0300
commit85d46c79c53ea73d76e5146523c09603788bcb2a (patch)
tree3ff6c0152ecc7c470c36c8ac11984f570826177a /git.c
parentdb9647bc5b51859d83f1e3ab299ccc03536e6cae (diff)
git: Use `format_len()` instead of `strlen()` when creating the repo
path in `init_git()`
Diffstat (limited to 'git.c')
-rw-r--r--git.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/git.c b/git.c
index da9386d..7b2fd6d 100644
--- a/git.c
+++ b/git.c
@@ -718,7 +718,7 @@ git_repo **init_git(config *cfg) {
if (entry.d_type == DT_DIR) {
/* Is the entry neither ".", nor ".."? */
if (strcmp(entry.d_name, ".") && strcmp(entry.d_name, "..")) {
- char *repo_dir = calloc(strlen(cfg->git_root) + strlen(entry.d_name) + 2, sizeof(char));
+ char *repo_dir = calloc(format_len("%s/%s", cfg->git_root, entry.d_name), sizeof(char));
/* Append the directory name to the git root. */
/* Could also do this: