From e9db11f387086787fb1aad5a853990e9e6034ad5 Mon Sep 17 00:00:00 2001 From: Dongmao Zhang Date: Wed, 21 May 2014 10:10:24 +0200 Subject: [PATCH] systemd: use umask 022 for generated systemd units by lvm2-activation-generator --- WHATS_NEW | 1 + scripts/lvm2_activation_generator_systemd_red_hat.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 86ed3bc7a..7f50eb120 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.107 - ================================== + Use proper umask for systemd units generated by lvm2-activation-generator. Check for failing mirror_remove_missing() function. Prompt before converting volumes to thin pool and thin pool metadata. Add dumpconfig --type profilable-{metadata,command} to select profile type. diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c index e39f901bb..6a003f587 100644 --- a/scripts/lvm2_activation_generator_systemd_red_hat.c +++ b/scripts/lvm2_activation_generator_systemd_red_hat.c @@ -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");