* [PATCH] erofs-utils: lib: fix incorrect usages of `erofs_strerror`
@ 2024-02-08 13:59 Tianyi Liu
2024-02-10 6:22 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Tianyi Liu @ 2024-02-08 13:59 UTC (permalink / raw
To: linux-erofs; +Cc: Tianyi Liu
`erofs_strerror` accepts a negative argument,
so `errno` should be negatived before passing to it.
Signed-off-by: Tianyi Liu <i.pear@outlook.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] erofs-utils: lib: fix incorrect usages of `erofs_strerror`
2024-02-08 13:59 [PATCH] erofs-utils: lib: fix incorrect usages of `erofs_strerror` Tianyi Liu
@ 2024-02-10 6:22 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2024-02-10 6:22 UTC (permalink / raw
To: Tianyi Liu; +Cc: linux-erofs
On Thu, Feb 08, 2024 at 09:59:09PM +0800, Tianyi Liu wrote:
> `erofs_strerror` accepts a negative argument,
> so `errno` should be negatived before passing to it.
>
> Signed-off-by: Tianyi Liu <i.pear@outlook.com>
Thanks, applied!
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-10 6:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 13:59 [PATCH] erofs-utils: lib: fix incorrect usages of `erofs_strerror` Tianyi Liu
2024-02-10 6:22 ` Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).