[systemd-commits] 2 commits - README src/shutdownd.c src/umount.c

Lennart Poettering lennart at kemper.freedesktop.org
Thu Oct 7 11:46:41 PDT 2010


 README          |    1 +
 src/shutdownd.c |    8 ++++----
 src/umount.c    |   10 +++-------
 3 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 143b4e9b8d6f4dd4b0603f7a1e8335b0c2774a77
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 7 20:46:35 2010 +0200

    shutdown: drop redundant read_only bool var

diff --git a/src/umount.c b/src/umount.c
index 4842d40..cdc42ed 100644
--- a/src/umount.c
+++ b/src/umount.c
@@ -35,7 +35,6 @@
 
 typedef struct MountPoint {
         char *path;
-        bool read_only;
         LIST_FIELDS (struct MountPoint, mount_point);
 } MountPoint;
 
@@ -46,8 +45,6 @@ static MountPoint *mount_point_alloc(char *path) {
                 return NULL;
 
         mp->path = path;
-        mp->read_only = false;
-
         return mp;
 }
 
@@ -270,7 +267,7 @@ static int delete_loopback(const char *device) {
 
         ioctl(fd, LOOP_CLR_FD, 0);
         r = errno;
-        close_nointr(fd);
+        close_nointr_nofail(fd);
 
         if (r == ENXIO) /* not bound, so no error */
                 r = 0;
@@ -307,10 +304,9 @@ static int mount_points_list_remount_read_only(MountPoint **mount_point_list_hea
                         continue;
 
                 /* Trying to remount read-only */
-                if (mount(NULL, mp->path, NULL, MS_MGC_VAL|MS_REMOUNT|MS_RDONLY, NULL) == 0) {
-                        mp->read_only = true;
+                if (mount(NULL, mp->path, NULL, MS_MGC_VAL|MS_REMOUNT|MS_RDONLY, NULL) == 0)
                         mount_point_remove_and_free(mp, mount_point_list_head);
-                } else {
+                else {
                         log_debug("Could not remount as read-only %s: %m", mp->path);
                         failed++;
                 }
commit ef9ffbd8065b9e06ef27fb989b1c783daf4dc1df
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Oct 7 20:46:02 2010 +0200

    shutdown: create /var/run/nologin instead of /etc/nologin which is supported since PAM 1.1.2

diff --git a/README b/README
index 12dc9fe..7566226 100644
--- a/README
+++ b/README
@@ -34,3 +34,4 @@ REQUIREMENTS:
         gtk+ >= 2.20
         dbus >= 1.2.24
         libcap
+        PAM >= 1.1.2 (optional)
diff --git a/src/shutdownd.c b/src/shutdownd.c
index 72a2801..bf69fb5 100644
--- a/src/shutdownd.c
+++ b/src/shutdownd.c
@@ -318,10 +318,10 @@ int main(int argc, char *argv[]) {
                 if (pollfd[FD_NOLOGIN_TIMER].revents) {
                         int e;
 
-                        log_info("Creating /etc/nologin, blocking further logins...");
+                        log_info("Creating /var/run/nologin, blocking further logins...");
 
-                        if ((e = touch("/etc/nologin")) < 0)
-                                log_error("Failed to create /etc/nologin: %s", strerror(-e));
+                        if ((e = write_one_line_file("/var/run/nologin", "System is going down.")) < 0)
+                                log_error("Failed to create /var/run/nologin: %s", strerror(-e));
                         else
                                 unlink_nologin = true;
 
@@ -346,7 +346,7 @@ finish:
                         close_nointr_nofail(pollfd[i].fd);
 
         if (unlink_nologin)
-                unlink("/etc/nologin");
+                unlink("/var/run/nologin");
 
         if (exec_shutdown) {
                 char sw[3];


More information about the systemd-commits mailing list