]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libhandle/handle.c
Various fixes to allow xfsdump/xfsrestore to work with 64K
[thirdparty/xfsprogs-dev.git] / libhandle / handle.c
index c535f2ff84a0ea74ee18105b6ec3f3c95af264cf..6276797485ec12360f53af2ea772b4fb8b9e7ead 100644 (file)
@@ -360,8 +360,11 @@ attr_list_by_handle(
 
        memcpy(&alhreq.pos, cursor, sizeof(alhreq.pos));
        alhreq.flags = flags;
-       alhreq.buflen = bufsize;
        alhreq.buffer = buf;
+       alhreq.buflen = bufsize;
+       /* prevent needless EINVAL from the kernel */
+       if (alhreq.buflen > XATTR_LIST_MAX)
+               alhreq.buflen = XATTR_LIST_MAX;
 
        error = xfsctl(path, fd, XFS_IOC_ATTRLIST_BY_HANDLE, &alhreq);