commit - 95500a936a1b0e42d304315fd2f7ae20ca391042
commit + 07ad49102564bf72092cc8080322852308490065
blob - f75fa1c1eafb0c2d8ab9069b2d490e5666ee1f08
blob + 47a9a21c1d430b3fc36576680198cf9cd9b6cc11
--- utils.c
+++ utils.c
char *
absolutify_path(const char *path)
{
- char *wd, *r;
+ char wd[PATH_MAX], *r;
if (*path == '/') {
if ((r = strdup(path)) == NULL)
return r;
}
- wd = getcwd(NULL, 0);
+ if (getcwd(wd, sizeof(wd)) == NULL)
+ fatal("getcwd");
if (asprintf(&r, "%s/%s", wd, path) == -1)
fatal("asprintf");
- free(wd);
return r;
}