I'm curious what is it specifically that you don't want
Read_Runlevel_Log to do and why? What's the expected vs actual behaviour
in this situation?
On 2024-01-26 22:48, Sam Varshavchik wrote:
So, I was wondering why rc.0 and rc.6 in Slackware 15 was going
sideways when i my alternative init daemon hack ran it. Everything was
going fine until rc.[06] executed:
if [ "$shutdown_command" = "reboot" ]; then
echo "Rebooting."
/sbin/reboot
else
/sbin/poweroff
fi
And ...things didn't quite reboot or poweroff here...
So, I'm sifting through sysvinit-3.04's source, and I see how
int Read_Runlevel_Log(int *runlevel)
does this to this int * parameter:
fscanf(log_file, "%c", (char *) runlevel);
and then back in halt.c's main() it looks at the end result here:
c = get_runlevel();
if (c != '0' && c != '6')
Well, that's not going to work very well. But why did the real vintage
init's working here. And then I saw the
getenv("INIT_VERSION")
in get_runlevel(), and my init wasn't setting this. Mystery solved.
I don't know how much this mattesr, these days, but it would be nice
if Read_Runlevel_Log() ... didn't do this...
Cheers,