[PATCH] erofs-utils: lib: fix packed xattr prefix seek

Vansh Choudhary <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
erofs_xattr_flush_name_prefixes() records the current packed file
offset, writes xattr prefixes with erofs_io_pwrite(), and then seeks
back to the new absolute end position.

Use SEEK_SET for that final lseek(). SEEK_CUR adds the tracked offset
to the unchanged file position and can leave the packed file offset too
far forward.

Signed-off-by: Vansh Choudhary <[email protected]>
---
 lib/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/xattr.c b/lib/xattr.c
index 565070a..9247004 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -946,7 +946,7 @@ int erofs_xattr_flush_name_prefixes(struct erofs_importer *im, bool plain)
 		erofs_bdrop(bh, false);
 	} else {
 		DBG_BUGON(bmgr);
-		if (lseek(vf->fd, offset, SEEK_CUR) < 0)
+		if (lseek(vf->fd, offset, SEEK_SET) < 0)
 			return -errno;
 	}
 	erofs_sb_set_xattr_prefixes(sbi);
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.