Add compatibility code to handle old path /etc/powerstatus for a while.
authorPetter Reinholdtsen <pere@hungry.com>
Sun, 11 Apr 2010 07:41:25 +0000 (07:41 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Sun, 11 Apr 2010 07:41:25 +0000 (07:41 +0000)
git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@60 456724a4-4300-0410-8514-c89748c515a2

doc/Changelog
src/init.c
src/paths.h

index aa4ae6770f4b92818c3502928e57c881ba5af88a..4cc6afb59795cdbc5602234bb5a2a78c3f9058d4 100644 (file)
@@ -27,6 +27,8 @@ sysvinit (2.88dsf) UNRELEASED; urgency=low
     find a usable pty.  Patch from Rob Leslie via Debian.
   * Make sure bootlogd fflush() every line, even if asked not to flush
     to disk using fdatasync().  Patch from Scott Gifford via Debian.
+  * Add compatibility code to handle old path "/etc/powerstatus" for a
+    while.
 
   [ Werner Fink ]
   * Add the comment from Andrea Arcangeli about the correct
index aa81d37963c99c14e83ad5433b18c25426e0bc9f..7b414f066fbedbeb06dcaa1d7d22559eaf2b8959 100644 (file)
@@ -2409,7 +2409,16 @@ void process_signals()
                pwrstat = c;
                close(fd);
                unlink(PWRSTAT);
-       }
+       } else if ((fd = open(PWRSTAT_OLD, O_RDONLY)) >= 0) {
+               /* Path changed 2010-03-20.  Look for the old path for a while. */
+               initlog(L_VB, "warning: found obsolete path %s, use %s instead",
+                       PWRSTAT_OLD, PWRSTAT);
+               c = 0;
+               read(fd, &c, 1);
+               pwrstat = c;
+               close(fd);
+               unlink(PWRSTAT_OLD);
+        }
        do_power_fail(pwrstat);
        DELSET(got_signals, SIGPWR);
   }
index bb5040dca360ac355b6befd0ef0dd73cf14a00eb..232a94415de5c6f4c4129dbb7e32eea129160bf5 100644 (file)
@@ -35,6 +35,7 @@
 #define SHELL          "/bin/sh"               /* Default shell */
 #define SULOGIN                "/sbin/sulogin"         /* Sulogin */
 #define INITSCRIPT     "/etc/initscript"       /* Initscript. */
+#define PWRSTAT_OLD    "/etc/powerstatus"      /* COMPAT: SIGPWR reason (OK/BAD) */
 #define PWRSTAT                "/var/run/powerstatus"  /* COMPAT: SIGPWR reason (OK/BAD) */
 
 #if 0