alternatives: handle dirname() returning ".".
This commit is contained in:
parent
d9f56c9cdf
commit
9ef83cfa69
@ -164,40 +164,44 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
|||||||
tgt_dup = strdup(tgt0);
|
tgt_dup = strdup(tgt0);
|
||||||
assert(tgt_dup);
|
assert(tgt_dup);
|
||||||
tgt_dir = dirname(tgt_dup);
|
tgt_dir = dirname(tgt_dup);
|
||||||
tgt = xbps_xasprintf("%s%s", xhp->rootdir, tgt_dir);
|
if (strcmp(tgt_dir, ".")) {
|
||||||
if (xbps_mkpath(tgt, 0755) != 0) {
|
tgt = xbps_xasprintf("%s%s", xhp->rootdir, tgt_dir);
|
||||||
if (errno != EEXIST) {
|
if (xbps_mkpath(tgt, 0755) != 0) {
|
||||||
rv = errno;
|
if (errno != EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "failed to create symlink"
|
rv = errno;
|
||||||
"target dir '%s' for group '%s': %s\n",
|
xbps_dbg_printf(xhp, "failed to create "
|
||||||
tgt, grname, strerror(errno));
|
"target dir '%s' for group '%s': %s\n",
|
||||||
free(tgt_dup);
|
tgt, grname, strerror(errno));
|
||||||
free(tgt);
|
free(tgt_dup);
|
||||||
free(l);
|
free(tgt);
|
||||||
return rv;
|
free(l);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
free(tgt);
|
||||||
}
|
}
|
||||||
free(tgt);
|
|
||||||
/* always create link dir, for dangling symlinks */
|
/* always create link dir, for dangling symlinks */
|
||||||
lnk_dup = strdup(l);
|
lnk_dup = strdup(l);
|
||||||
assert(lnk_dup);
|
assert(lnk_dup);
|
||||||
lnk_dir = dirname(lnk_dup);
|
lnk_dir = dirname(lnk_dup);
|
||||||
lnk = xbps_xasprintf("%s%s", xhp->rootdir, lnk_dir);
|
if (strcmp(lnk_dir, ".")) {
|
||||||
if (xbps_mkpath(lnk, 0755) != 0) {
|
lnk = xbps_xasprintf("%s%s", xhp->rootdir, lnk_dir);
|
||||||
if (errno != EEXIST) {
|
if (xbps_mkpath(lnk, 0755) != 0) {
|
||||||
rv = errno;
|
if (errno != EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "failed to create symlink"
|
rv = errno;
|
||||||
"dir '%s' for group '%s': %s\n",
|
xbps_dbg_printf(xhp, "failed to create symlink"
|
||||||
lnk, grname, strerror(errno));
|
"dir '%s' for group '%s': %s\n",
|
||||||
free(tgt_dup);
|
lnk, grname, strerror(errno));
|
||||||
free(tgt);
|
free(tgt_dup);
|
||||||
free(lnk_dup);
|
free(tgt);
|
||||||
free(lnk);
|
free(lnk_dup);
|
||||||
free(l);
|
free(lnk);
|
||||||
return rv;
|
free(l);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
free(lnk);
|
||||||
}
|
}
|
||||||
free(lnk);
|
|
||||||
free(lnk_dup);
|
free(lnk_dup);
|
||||||
|
|
||||||
if (l[0] != '/') {
|
if (l[0] != '/') {
|
||||||
|
Loading…
Reference in New Issue
Block a user