X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmachine-id-setup.c;h=65792e9b842357b2f0b87e1f08403a64a094ddb4;hp=940670b339504f24d0415cbc95143a6433c7c3d8;hb=d68201e9aa5e9ebd6085b1bb8892c42e9d20be75;hpb=d7ccca2e3f86feb81a48e243d8bad78814659a74 diff --git a/src/machine-id-setup.c b/src/machine-id-setup.c index 940670b33..65792e9b8 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) { @@ -155,7 +160,7 @@ int machine_id_setup(void) { if (r < 0) log_error("Failed to mount /etc/machine-id: %s", strerror(-r)); else - log_info("Installed non-transient /etc/machine-id file."); + log_info("Installed transient /etc/machine-id file."); finish: