bin/xbps-uchroot: allow relative chroot directory

This commit is contained in:
Duncaen 2016-09-25 22:22:27 +02:00
parent 7d06fb0e71
commit c5784e9cc3

View File

@ -319,6 +319,14 @@ main(int argc, char **argv)
if (strcmp(chrootdir, "/") == 0)
die("/ is not allowed to be used as chrootdir");
/* Make chrootdir absolute */
if (chrootdir[0] != '/') {
char cwd[PATH_MAX-1];
if (getcwd(cwd, sizeof(cwd)) == NULL)
die("getcwd");
chrootdir = xbps_xasprintf("%s/%s", cwd, chrootdir);
}
if (getresgid(&rgid, &egid, &sgid) == -1)
die("getresgid");