diff options
author | Richard Hughes <richard@hughsie.com> | 2014-11-19 11:15:27 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-11-19 13:45:55 +0000 |
commit | 4716fd4db29b3d66594545d445e54dda25dda137 (patch) | |
tree | a7ceec7374caf4556e4640c2b0bc56266b9a635b /client/cd-util.c | |
parent | 49170ad2544f4a0a17164f2b622d1e52a86f8ac7 (diff) | |
download | colord-4716fd4db29b3d66594545d445e54dda25dda137.tar.gz |
Don't assume pwd.h is always available
Diffstat (limited to 'client/cd-util.c')
-rw-r--r-- | client/cd-util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/client/cd-util.c b/client/cd-util.c index 9f45e3d..abad25b 100644 --- a/client/cd-util.c +++ b/client/cd-util.c @@ -24,7 +24,9 @@ #include <glib/gi18n.h> #include <gio/gio.h> #include <locale.h> +#ifdef HAVE_PWD_H #include <pwd.h> +#endif #include <stdlib.h> #include <stdio.h> #include <colord/colord.h> @@ -137,10 +139,17 @@ cd_util_print_field_time (const gchar *title, static void cd_util_show_owner (CdUtilPrivate *priv, guint uid) { +#ifdef HAVE_PWD_H struct passwd *pw; pw = getpwuid (uid); /* TRANSLATORS: profile owner */ cd_util_print_field (_("Owner"), "owner", priv, pw->pw_name); +#else + _cleanup_free_ gchar *str = NULL; + str = g_strdup_printf ("%u", uid); + /* TRANSLATORS: profile UID */ + cd_util_print_field (_("Owner"), "owner", priv, str); +#endif } /** |