xbps_init: simplify previous and use xbps_xasprintf().
This commit is contained in:
parent
b894a5eca3
commit
bf2d97a067
@ -171,15 +171,11 @@ xbps_init(struct xbps_handle *xhp)
|
||||
if (xhp->rootdir[0] != '/') {
|
||||
/* relative path */
|
||||
char *buf, path[PATH_MAX-1];
|
||||
size_t len;
|
||||
|
||||
if (getcwd(path, sizeof(path)) == NULL)
|
||||
return ENOTSUP;
|
||||
|
||||
len = strlen(xhp->rootdir) + strlen(path) + 2;
|
||||
buf = malloc(len);
|
||||
assert(buf);
|
||||
snprintf(buf, len, "%s/%s", path, xhp->rootdir);
|
||||
buf = xbps_xasprintf("%s/%s", path, xhp->rootdir);
|
||||
xhp->rootdir = buf;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user