aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2020-01-08 10:59:37 -0500
committerTheodore Ts'o <tytso@mit.edu>2020-01-08 15:59:01 -0500
commit00179a29867b72c47e074d8e0babe6622d074dba (patch)
tree49574ae788d83eead6b4cd670a2feb87a54fc5c0
parentc2b1ec5fbc99ab8a2b71dae45d486b3ea004f618 (diff)
downloade2fsprogs-00179a29867b72c47e074d8e0babe6622d074dba.tar.gz
libcom_err: deal with the fact that the Hurd error messages are not zero-based
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--debian/changelog9
-rw-r--r--lib/et/error_message.c13
2 files changed, 18 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index d26f8db38..bf82d154b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+e2fsprogs (1.45.5-2) unstable; urgency=medium
+
+ * Fix com_err support on Hurd, which has POSIX E* error code starting at
+ 0x40000000. Otherwise the regression tests will fail since the
+ expected output for various error cases will not have the correct
+ error text.
+
+ -- Theodore Y. Ts'o <tytso@mit.edu> Wed, 08 Jan 2020 15:58:44 -0500
+
e2fsprogs (1.45.5-1) unstable; urgency=medium
* New upstream feature
diff --git a/lib/et/error_message.c b/lib/et/error_message.c
index bd18be781..cd9f57f56 100644
--- a/lib/et/error_message.c
+++ b/lib/et/error_message.c
@@ -113,6 +113,11 @@ gettextf set_com_err_gettext(gettextf new_proc)
return x;
}
+#ifdef __GNU__
+#define SYS_ERR_BASE 0x40000000
+#else
+#define SYS_ERR_BASE 0
+#endif
const char * error_message (errcode_t code)
{
@@ -124,14 +129,14 @@ const char * error_message (errcode_t code)
offset = (int) (code & ((1<<ERRCODE_RANGE)-1));
table_num = code - offset;
- if (!table_num) {
+ if (table_num == SYS_ERR_BASE) {
#ifdef HAS_SYS_ERRLIST
- if (offset < sys_nerr)
- return(sys_errlist[offset]);
+ if (code < sys_nerr)
+ return(sys_errlist[code]);
else
goto oops;
#else
- cp = strerror(offset);
+ cp = strerror(code);
if (cp)
return(cp);
else