I have a program that display the log output to the stdout.
So if I open a telnet session to my target linux and then launch on this telnet session my program then I will get the log messages displayed on my telnet session.
In my program I have a little http server running. Now if I change the IP address of my target linux and then I restart the interface (the http server will restart automatically because I detect the change of ip address with netlink) And then I will get the telnet session closed and the stdout messages are redirected to the socket opened by my http server and I will get the printf of the log message locked.
I tried with select to detect this lock but without success: How to use select with stdout?
The select return success before going to the prinf (which locks)
Any suggestion to avoid this problem ?