Add compatibility code to handle old path /etc/powerstatus for a while.

This commit is contained in:
Petter Reinholdtsen 2010-04-11 07:41:25 +00:00
parent 1ef67cb310
commit 66299c783d
3 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,8 @@ sysvinit (2.88dsf) UNRELEASED; urgency=low
find a usable pty. Patch from Rob Leslie via Debian. find a usable pty. Patch from Rob Leslie via Debian.
* Make sure bootlogd fflush() every line, even if asked not to flush * Make sure bootlogd fflush() every line, even if asked not to flush
to disk using fdatasync(). Patch from Scott Gifford via Debian. to disk using fdatasync(). Patch from Scott Gifford via Debian.
* Add compatibility code to handle old path "/etc/powerstatus" for a
while.
[ Werner Fink ] [ Werner Fink ]
* Add the comment from Andrea Arcangeli about the correct * Add the comment from Andrea Arcangeli about the correct

View File

@ -2409,7 +2409,16 @@ void process_signals()
pwrstat = c; pwrstat = c;
close(fd); close(fd);
unlink(PWRSTAT); 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); do_power_fail(pwrstat);
DELSET(got_signals, SIGPWR); DELSET(got_signals, SIGPWR);
} }

View File

@ -35,6 +35,7 @@
#define SHELL "/bin/sh" /* Default shell */ #define SHELL "/bin/sh" /* Default shell */
#define SULOGIN "/sbin/sulogin" /* Sulogin */ #define SULOGIN "/sbin/sulogin" /* Sulogin */
#define INITSCRIPT "/etc/initscript" /* Initscript. */ #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) */ #define PWRSTAT "/var/run/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */
#if 0 #if 0