error.h: Make PARA_STRERROR understand system errors.
[paraslash.git] / error.h
diff --git a/error.h b/error.h
index d648f14e33abc54c11c6228b828c9542dbcb8060..5ed3830450b2b1e19bf76600513f1c7e7ebc562d 100644 (file)
--- a/error.h
+++ b/error.h
@@ -521,7 +521,11 @@ extern const char **para_errlist[];
  *
  * expands to the error text of \a num (a string constant).
  */
  *
  * expands to the error text of \a num (a string constant).
  */
-#define PARA_STRERROR(num) para_errlist[ERRNUM_TO_SS(num)] [ERRNUM_TO_INDEX(num)]
+#define PARA_STRERROR(num) (num) & (1 << 30)? \
+       strerror((num) & ((1 << 30) - 1)) : \
+       para_errlist[ERRNUM_TO_SS(num)] [ERRNUM_TO_INDEX(num)]
+
+#define ERRNO_TO_PARA_ERROR(num) (-((num) | (1 << 30)))
 
 /**
  * define the error list for one subsystem
 
 /**
  * define the error list for one subsystem