[gnome-shell/eos3.8: 118/255] util: Add a wrapper around getuid()
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 118/255] util: Add a wrapper around getuid()
- Date: Wed, 10 Jun 2020 19:07:54 +0000 (UTC)
commit 6789bc9443347e2060aae56bd283c666759d64b0
Author: Philip Withnall <withnall endlessm com>
Date: Thu Nov 22 15:03:04 2018 +0000
util: Add a wrapper around getuid()
So we can use it from JS in an upcoming commit.
Signed-off-by: Philip Withnall <withnall endlessm com>
https://phabricator.endlessm.com/T24016
src/shell-util.c | 14 ++++++++++++++
src/shell-util.h | 2 ++
2 files changed, 16 insertions(+)
---
diff --git a/src/shell-util.c b/src/shell-util.c
index d1a75bc6b4..bb2329536b 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -638,6 +638,20 @@ shell_util_check_cloexec_fds (void)
g_info ("Open fd CLOEXEC check complete");
}
+/**
+ * shell_util_get_uid:
+ *
+ * A wrapper around getuid() so that it can be used from JavaScript. This
+ * function will always succeed.
+ *
+ * Returns: the real user ID of the calling process
+ */
+gint
+shell_util_get_uid (void)
+{
+ return getuid ();
+}
+
static void
on_systemd_call_cb (GObject *source,
GAsyncResult *res,
diff --git a/src/shell-util.h b/src/shell-util.h
index 055e881905..aa79f49736 100644
--- a/src/shell-util.h
+++ b/src/shell-util.h
@@ -78,6 +78,8 @@ gboolean shell_util_has_x11_display_extension (MetaDisplay *display,
char *shell_util_get_translated_folder_name (const char *name);
+gint shell_util_get_uid (void);
+
G_END_DECLS
#endif /* __SHELL_UTIL_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]