Skip to content

Commit

Permalink
libutil/fname: optimize the way to append "." to a vstr
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Apr 29, 2023
1 parent c79f1a8 commit 538d9f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/fname.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ static char *canonicalizePathNew(const char *dir, size_t dir_len, const char *re
if (r[dir_len] == '/')
{
if (r[dir_len + 1] == '\0')
vStringCopyS (buf, ".");
vStringNCopyS (buf, ".", 1);
else
vStringCopyS (buf, r + dir_len + 1);
eFree (r);
return vStringDeleteUnwrap (buf);
}
else if (r[dir_len] == '\0')
{
vStringCopyS (buf, ".");
vStringNCopyS (buf, ".", 1);
eFree (r);
return vStringDeleteUnwrap (buf);
}
Expand Down

0 comments on commit 538d9f1

Please sign in to comment.