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

@@ -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);
}