makefs: handle mtree link= for ZFS
When a link target is specified use it rather than attempting to read a potentially non-existant file. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D38028
This commit is contained in:
parent
aac389a347
commit
b78d5b4241
@ -297,15 +297,23 @@ fs_readlink(const fsnode *cur, struct fs_populate_arg *arg,
|
||||
char *buf, size_t bufsz)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
ssize_t n;
|
||||
int fd;
|
||||
|
||||
if (cur->symlink != NULL) {
|
||||
size_t n;
|
||||
|
||||
n = strlcpy(buf, cur->symlink, bufsz);
|
||||
assert(n < bufsz);
|
||||
} else {
|
||||
ssize_t n;
|
||||
|
||||
fs_populate_path(cur, arg, path, sizeof(path), &fd);
|
||||
|
||||
n = readlinkat(fd, path, buf, bufsz - 1);
|
||||
if (n == -1)
|
||||
err(1, "readlinkat(%s)", cur->name);
|
||||
buf[n] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user