fflush stdin in actsync

Bo Lindbergh 2bfjdsla52kztwejndzdstsxl9athp at gmail.com
Sun Apr 3 15:03:40 UTC 2016


Quoth Richard Kettlewell:
> It's undefined in C99 but has defined behavior in SUS:
> 
> For a stream open for reading, if the file is not already at EOF, and
> the file is one capable of seeking, the file offset of the underlying
> open file description shall be set to the file position of the stream,
> and any characters pushed back onto the stream by ungetc() or ungetwc()
> that have not subsequently been read from the stream shall be discarded
> (without further changing the file offset)

That sounds like the intended use is for syncing the position
of a file descriptor that is going to be inherited by another program.

However, this is not what the exec_cmd function in actsync.c does;
it calls fclose(stdin) in the child process before exec-ing ctlinnd.

I suggest deleting the fflush(stdin).


/Bo Lindbergh



More information about the inn-workers mailing list