Skip to contentSkip to conversation

Mark the generated service file avaliable to be accessed

PATCH New dongmao zhang 2 participants 2 messages May 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mark the generated service file avaliable to be accessed

'journalctl -b' reports this:

May 17 08:21:00 test systemd[1]: Configuration file

/run/systemd/generator/lvm2-activation-early.service is marked world-inaccessible. This has no effect as configuration data is accessible via
APIs without restrictions. Proceeding anyway.

So, set the mask to 022 for all the generators

---
 scripts/lvm2_activation_generator_systemd_red_hat.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/lvm2_activation_generator_systemd_red_hat.c +4 -0
index e39f901..6a003f5 100644
@@ -170,6 +170,7 @@ int main(int argc, char *argv[])
 {
 	const char *dir;
 	int r = EXIT_SUCCESS;
+	mode_t old_mask;
 
 	kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY|O_NOCTTY);
 
@@ -184,10 +185,13 @@ int main(int argc, char *argv[])
 
 	dir = argv[1];
 
+	/* mark lvm2-activation.*.service as world-accessible */
+	old_mask = umask(0022);
 	if (!generate_unit(dir, UNIT_EARLY) ||
 	    !generate_unit(dir, UNIT_MAIN) ||
 	    !generate_unit(dir, UNIT_NET))
 		r = EXIT_FAILURE;
+	umask(old_mask);
 out:
 	if (r)
 		kmsg(LOG_ERR, "LVM: Activation generator failed.\n");
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH 1/1 Mark the generated service file avaliable to be accessed

Quoted 29 lines · dongmao zhang

'journalctl -b' reports this:

May 17 08:21:00 test systemd[1]: Configuration file

/run/systemd/generator/lvm2-activation-early.service is marked world-inaccessible. This has no effect as configuration data is accessible via
APIs without restrictions. Proceeding anyway.

So, set the mask to 022 for all the generators

---
 scripts/lvm2_activation_generator_systemd_red_hat.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/lvm2_activation_generator_systemd_red_hat.c +1 -0
index e39f901..6a003f5 100644
@@ -170,6 +170,7 @@ int main(int argc, char *argv[])
 {
 	const char *dir;
 	int r = EXIT_SUCCESS;
+	mode_t old_mask;
 
 	kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY|O_NOCTTY);
 
@@ -184,10 +185,13 @@ int main(int argc, char *argv[])
 
 	dir = argv[1];
 

scripts/lvm2_activation_generator_systemd_red_hat.c int main(int argc, char *argv[]) · line 197

Quoted 10 lines
scripts/lvm2_activation_generator_systemd_red_hat.c +3 -0
+	/* mark lvm2-activation.*.service as world-accessible */
+	old_mask = umask(0022);
 	if (!generate_unit(dir, UNIT_EARLY) ||
 	    !generate_unit(dir, UNIT_MAIN) ||
 	    !generate_unit(dir, UNIT_NET))
 		r = EXIT_FAILURE;
+	umask(old_mask);
 out:
 	if (r)
 		kmsg(LOG_ERR, "LVM: Activation generator failed.\n");

Applied. Thanks for the patch!

https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=e9db11f387086787fb1aad5a853990e9e6034ad5

Signature · 1 line
Peter