aboutsummaryrefslogtreecommitdiffstats
path: root/src/libgamma-error.c.gpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libgamma-error.c.gpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libgamma-error.c.gpp b/src/libgamma-error.c.gpp
index 7e44c0d..9b274ab 100644
--- a/src/libgamma-error.c.gpp
+++ b/src/libgamma-error.c.gpp
@@ -55,7 +55,10 @@ const char* libgamma_group_name = NULL;
* used to print the current error stored in `errno`.
* If `error_code` is non-negative (an `errno` value`), that
* value will be stored in `errno` and `perror` will be
- * used to print it.
+ * used to print it. Additionally, if the `error_code` is
+ * the value of `LIBGAMMA_DEVICE_REQUIRE_GROUP` the
+ * required group will be printed with its numerical value
+ * and, if known, its name.
*
* @param name The text to add at the beginning.
* @param value The error code, may be an `errno` value.
@@ -69,6 +72,15 @@ void libgamma_perror(const char* name, int error_code)
}
else if (error_code == LIBGAMMA_ERRNO_SET)
perror(name);
+ else if (error_code == LIBGAMMA_DEVICE_REQUIRE_GROUP)
+ {
+ const char* error = libgamma_name_of_error(error_code);
+ long int gid = (long int)libgamma_group_gid;
+ if (libgamma_group_name == NULL)
+ fprintf(stderr, "%s: %s: %ld\n", name, error, gid);
+ else
+ fprintf(stderr, "%s: %s: %s (%lid)\n", name, error, libgamma_group_name, gid);
+ }
else if (error_code < LIBGAMMA_ERROR_MIN)
fprintf(stderr, "%s: (?)\n", name);
else