`erofs_strerror` accepts a negative argument, so `errno` should be negatived before passing to it.
Signed-off-by: Tianyi Liu <[email protected]> --- lib/inode.c | 2 +- lib/tar.c | 2 +- lib/xattr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/inode.c b/lib/inode.c index c6424c0..2a9b18c 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -1146,7 +1146,7 @@ static int erofs_mkfs_build_tree(struct erofs_inode *dir, struct list_head *dirs _dir = opendir(dir->i_srcpath); if (!_dir) { erofs_err("failed to opendir at %s: %s", - dir->i_srcpath, erofs_strerror(errno)); + dir->i_srcpath, erofs_strerror(-errno)); return -errno; } diff --git a/lib/tar.c b/lib/tar.c index 8204939..ead74ba 100644 --- a/lib/tar.c +++ b/lib/tar.c @@ -106,7 +106,7 @@ int erofs_iostream_open(struct erofs_iostream *ios, int fd, int decoder) #ifdef HAVE_POSIX_FADVISE if (posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL)) erofs_warn("failed to fadvise: %s, ignored.", - erofs_strerror(errno)); + erofs_strerror(-errno)); #endif } ios->bufsize = 16384; diff --git a/lib/xattr.c b/lib/xattr.c index 77c8c3a..427933f 100644 --- a/lib/xattr.c +++ b/lib/xattr.c @@ -698,7 +698,7 @@ static int erofs_count_all_xattrs_from_path(const char *path) _dir = opendir(path); if (!_dir) { erofs_err("failed to opendir at %s: %s", - path, erofs_strerror(errno)); + path, erofs_strerror(-errno)); return -errno; } -- 2.43.0
