aboutsummaryrefslogtreecommitdiffstats
path: root/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch')
-rw-r--r--community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch b/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch
new file mode 100644
index 0000000000..345f76d410
--- /dev/null
+++ b/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch
@@ -0,0 +1,45 @@
+From fdeef40875bebf3970d1365dc92cb893a0298097 Mon Sep 17 00:00:00 2001
+From: Rasmus Thomsen <oss@cogitri.dev>
+Date: Fri, 3 Jul 2020 12:19:52 +0200
+Subject: [PATCH 2/2] Ensure 0664 permissions on /etc/localtime
+
+Otherwise the timezone couldn't be read by other users
+---
+ src/timedated.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/timedated.c b/src/timedated.c
+index a6779f9..77d12ee 100644
+--- a/src/timedated.c
++++ b/src/timedated.c
+@@ -26,6 +26,7 @@
+
+ #include <dbus/dbus-protocol.h>
+ #include <glib.h>
++#include <glib/gstdio.h>
+ #include <gio/gio.h>
+
+ #if HAVE_OPENRC
+@@ -135,6 +136,9 @@ set_timezone (const gchar *_timezone_name,
+ g_prefix_error (error, "Unable to write '%s':", timezone_filename);
+ goto out;
+ }
++ if(g_chmod (timezone_filename, 0664) != 0) {
++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, "Unable to set 0664 permissions on timezone file '%s'", timezone_filename);
++ }
+
+ localtime_filename = g_file_get_path (localtime_file);
+ localtime2_filename = g_strdup_printf (DATADIR "/zoneinfo/%s", _timezone_name);
+@@ -158,6 +162,9 @@ set_timezone (const gchar *_timezone_name,
+ g_prefix_error (error, "Unable to write '%s':", localtime_filename);
+ goto out;
+ }
++ if(g_chmod (localtime_filename, 0664) != 0) {
++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, "Unable to set 0664 permissions on localtime file '%s'", localtime_filename);
++ }
+ } else {
+ // File doesn't exist yet -> make a new symlink
+ if (!g_file_make_symbolic_link (localtime_file, localtime2_filename, NULL, error)) {
+--
+2.26.2
+