I did some debugging.
I've attached the patch I've applied to the 3.04 of sysvinit
bootlogd.c src file.
It includes your changes plus additional debug printfs.
The process is started with the following command in the init.d script:
nohup stdbuf -o0 -e0 $DAEMON -r -c -d > /tmp/bootlogd.log 2>&1 &
The log file begins with the following lines, and repeats "forever":
TEST
TEST
TEST
TEST1
TEST2 -1
TEST3 /dev/ttyS0
TEST4.2
TEST4.3
TEST1
TEST2 -1
TEST3 /dev/ttyS0
TEST4.2
TEST4.3
TEST1
TEST2 -1
TEST3 /dev/ttyS0
TEST4.2
TEST4.3
TEST1
TEST2 -1
TEST3 /dev/ttyS0
TEST4.2
TEST4.3
So I guess your assumption is correct, that the opening is successful,
but writing always fail.
P.S. sorry for the spam...
I don't get the emails to my mailbox, so I cannot simply reply, but
have to manually create the mails. Because of a delay, I feared that
the messages were not correctly formated, so I answered 4 times, with
slightly different message headers, but in the end, all got delivered -_-
Thank you for the testing. It does look like the suspicions about the
file being available for opening, but not writing are correct. And the
patch from Peter looks promising. I'm going to update it slightly to
deal with the changes since the patch was made and see if it works.
Jesse