diff mbox series

[2/3] e2fsck: don't print errcode if the errcode is 0

Message ID 20210204233601.2369470-2-harshads@google.com
State Rejected
Headers show
Series [1/3] ext2fs: initialize handle to NULL in ext2fs_count_blks | expand

Commit Message

harshad shirwadkar Feb. 4, 2021, 11:36 p.m. UTC
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

We print the error message corresponding to errcode while converting
errcode to errno. Don't do that if errcode is 0.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
 e2fsck/journal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Theodore Ts'o Feb. 9, 2021, 4:48 a.m. UTC | #1
On Thu, Feb 04, 2021 at 03:36:00PM -0800, Harshad Shirwadkar wrote:
> From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
> 
> We print the error message corresponding to errcode while converting
> errcode to errno. Don't do that if errcode is 0.
> 
> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

It looks like this change is already in commit 63b7192cae60 ("e2fsck:
add fc replay for link, unlink, creat tags") which is already in the
upstream repo?

						- Ted
diff mbox series

Patch

diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index b1ca485c..922c252d 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -383,7 +383,9 @@  out_err:
 
 static int __errcode_to_errno(errcode_t err, const char *func, int line)
 {
-	fprintf(stderr, "Error \"%s\" encountered in %s at line %d\n",
+	if (err == 0)
+		return 0;
+	fprintf(stderr, "Error \"%s\" encountered in function %s at line %d\n",
 		error_message(err), func, line);
 	if (err <= 256)
 		return -err;