summaryrefslogtreecommitdiff
path: root/src/machine-id-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-04 22:50:56 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-04 22:50:56 +0100
commit76526bad9fbe936af69baec576674135585e6130 (patch)
treec16465160b0e3e8bdba79cd23dc6c74cb3de4301 /src/machine-id-setup.c
parent9b4f818bd8dd45029992f844d07a61c9977da720 (diff)
machine-id: generate /etc/machine-id 0444 by default
Diffstat (limited to 'src/machine-id-setup.c')
-rw-r--r--src/machine-id-setup.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/machine-id-setup.c b/src/machine-id-setup.c
index 0ec6192449..65792e9b84 100644
--- a/src/machine-id-setup.c
+++ b/src/machine-id-setup.c
@@ -91,7 +91,12 @@ int machine_id_setup(void) {
m = umask(0000);
- if ((fd = open("/etc/machine-id", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0644)) >= 0)
+ /* We create this 0444, to indicate that this isn't really
+ * something you should ever modify. Of course, since the file
+ * will be owned by root it doesn't matter much, but maybe
+ * people look. */
+
+ if ((fd = open("/etc/machine-id", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444)) >= 0)
writable = true;
else {
if ((fd = open("/etc/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY)) < 0) {