xbps-create: handle another variant of a relative symlink.

(cherry picked from commit 7d849c2a656246be808206baa0adae2da1c9132d)
This commit is contained in:
Juan RP 2012-09-23 15:48:02 +02:00
parent e989b74c6a
commit c39c1e5751

View File

@ -212,7 +212,12 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf)
* Check if symlink is absolute or relative; on the former
* make it absolute for the target object.
*/
if (strchr(buf, '/') == NULL) {
if (strncmp(buf, "../", 3) == 0) {
p = realpath(fpath, NULL);
assert(p);
xe->target = strdup(p + strlen(destdir));
free(p);
} else if (strchr(buf, '/') == NULL) {
p = strdup(filep);
assert(p);
dname = dirname(p);