[systemd-commits] src/machine-id-setup.c

Lennart Poettering lennart at kemper.freedesktop.org
Fri Mar 4 13:51:02 PST 2011


 src/machine-id-setup.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 76526bad9fbe936af69baec576674135585e6130
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 4 22:50:56 2011 +0100

    machine-id: generate /etc/machine-id 0444 by default

diff --git a/src/machine-id-setup.c b/src/machine-id-setup.c
index 0ec6192..65792e9 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) {



More information about the systemd-commits mailing list