aboutsummaryrefslogtreecommitdiffstats
path: root/libgamma_perror.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-03-05 23:30:24 +0100
committerMattias Andrée <maandree@kth.se>2021-03-05 23:30:24 +0100
commit80a78b91c2905fcacf0236d63a9f4e3d7e576d7e (patch)
tree305419312ba536e041be28bb271118e0ccf6956b /libgamma_perror.c
parentm (diff)
downloadlibgamma-80a78b91c2905fcacf0236d63a9f4e3d7e576d7e.tar.gz
libgamma-80a78b91c2905fcacf0236d63a9f4e3d7e576d7e.tar.bz2
libgamma-80a78b91c2905fcacf0236d63a9f4e3d7e576d7e.tar.xz
minor fixes + add tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libgamma_perror.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libgamma_perror.c b/libgamma_perror.c
index 92060d8..62af75a 100644
--- a/libgamma_perror.c
+++ b/libgamma_perror.c
@@ -19,6 +19,8 @@ libgamma_perror(const char *name, int error_code)
if (error_code == LIBGAMMA_DEVICE_REQUIRE_GROUP) {
gid = (intmax_t)libgamma_group_gid_get();
+ if (!gid)
+ goto fallback;
gname = libgamma_group_name_get();
if (!gname) {
if (name && *name)
@@ -27,11 +29,12 @@ libgamma_perror(const char *name, int error_code)
fprintf(stderr, "%s in group %ji\n", desc, gid);
} else {
if (name && *name)
- fprintf(stderr, "%s: %s in group %s (%ji)\n", name, desc, gname, gid);
+ fprintf(stderr, "%s: %s in the %s group (%ji)\n", name, desc, gname, gid);
else
- fprintf(stderr, "%s in group %s (%ji)\n", desc, gname, gid);
+ fprintf(stderr, "%s in the %s group (%ji)\n", desc, gname, gid);
}
} else {
+ fallback:
if (name && *name)
fprintf(stderr, "%s: %s\n", name, desc);
else