summaryrefslogtreecommitdiff
path: root/client/cd-util.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-11-19 11:15:27 +0000
committerRichard Hughes <richard@hughsie.com>2014-11-19 13:45:55 +0000
commit4716fd4db29b3d66594545d445e54dda25dda137 (patch)
treea7ceec7374caf4556e4640c2b0bc56266b9a635b /client/cd-util.c
parent49170ad2544f4a0a17164f2b622d1e52a86f8ac7 (diff)
downloadcolord-4716fd4db29b3d66594545d445e54dda25dda137.tar.gz
Don't assume pwd.h is always available
Diffstat (limited to 'client/cd-util.c')
-rw-r--r--client/cd-util.c9
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
}
/**