Skip to contentSkip to conversation

filefrag: fix fibmap error message

PATCH In review David Timber 3 participants 4 messages Mar 3 – Mar 14

lore
Share & tools
lore
#0 lore raw

cover filefrag: fix fibmap error message

There's a silly mistake in misc/filefrag.c. It's a single character change.

get_block() of various fs can return any errno at all. FUSE is especially wild west out there and the fact that POSIX allowing NULL and Musl simply refusing to snprintf() doesn't really help either...

David Timber (1):
filefrag: fix fibmap error message

 misc/filefrag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.53.0.1.ga224b40d3f.dirty
#1 lore raw

PATCH 1/1 filefrag: fix fibmap error message

When an errno other than EINVAL, ENOTTY or EPERM is returned from FIBMAP ioctl, the negative errno is passsed to strerror(), which only accepts positive errno values.

---
 misc/filefrag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
misc/filefrag.c +1 -1
index 4641714c..d45288cd 100644
@@ -517,7 +517,7 @@ static int frag_report(const char *filename)
 					filename);
 			} else {
 				fprintf(stderr, "%s: FIBMAP error: %s",
-					filename, strerror(expected));
+					filename, strerror(-expected));
 			}
 			rc = expected;
 			goto out_close;
Signature · 1 line
2.53.0.1.ga224b40d3f.dirty
Reviewed-by on v1 1/1
#2 lore raw
Quoted 6 lines · David Timber

When an errno other than EINVAL, ENOTTY or EPERM is returned from FIBMAP ioctl, the negative errno is passsed to strerror(), which only accepts positive errno values.

Reviewed-by Andreas Dilger <[email protected] <mailto:[email protected]>>
Quoted 21 lines

---
misc/filefrag.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
misc/filefrag.c +1 -1
index 4641714c..d45288cd 100644
@@ -517,7 +517,7 @@ static int frag_report(const char *filename)
 filename);
 			} else {
 				fprintf(stderr, "%s: FIBMAP error: %s",
-					filename, strerror(expected));
+					filename, strerror(-expected));
 			}
 			rc = expected;
 			goto out_close;
Signature · 1 line
2.53.0.1.ga224b40d3f.dirty
Reviewed-by on v1 1/1
#3 lore raw
In reply to David Timber
Quoted 4 lines · David Timber

When an errno other than EINVAL, ENOTTY or EPERM is returned from FIBMAP ioctl, the negative errno is passsed to strerror(), which only accepts positive errno values.

LGTM.

Quoted 20 lines
---
 misc/filefrag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
misc/filefrag.c +1 -1
index 4641714c..d45288cd 100644
@@ -517,7 +517,7 @@ static int frag_report(const char *filename)
 					filename);
 			} else {
 				fprintf(stderr, "%s: FIBMAP error: %s",
-					filename, strerror(expected));
+					filename, strerror(-expected));
 			}
 			rc = expected;
 			goto out_close;
Signature · 1 line
2.53.0.1.ga224b40d3f.dirty