Hi Vladimir,

The cast to void on the read is exactly how one is supposed to indicate that the result *should* be ignored. MHD_itc_clear() is only supposed to clear the pipe, and if it failed (say SIGINT), it'll be retried anyway, so no harm there, the code is correct and should IMO not be changed.

Same for the fgets(): it's just to terminate the benchmark, we don't care if the user terminated with CTRL-D, CTRL-C or ENTER or typed stuff before hitting ENTER. So ignoring it is totally fine.

I don't see a reason to change any of this.

Happy hacking!

Christian

On 10/2/26 5:21 AM, Vladimir Yavorsky wrote:
Hello GNU libmicrohttpd team,
My name is Vladimir Yavorsky, and I am a software engineer. While building your libmicrohttpd packages, I encountered warnings about ignored read() and fgets() results. The following code is present in source versions 1.0.1, 1.0.2, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9 and 1.0.10:

  * src/microhttpd/mhd_itc.h: the eventfd implementation of
    MHD_itc_clear_() discards the read() result with a cast to void.
  * src/tools/perf_replies.c: the Enter-to-stop path discards the
    fgets() result.

The warnings were reproduced with unmodified 1.0.10 and GCC 13.3.0, using these commands from the source directory:

    CFLAGS='-O2 -g -D_FORTIFY_SOURCE=2 -Wunused-result' \
    ./configure --disable-https --disable-doc --disable-examples \
                 --disable-static --enable-shared
    make -j2


Is ignoring these results intentional? Would you consider retrying read() on EINTR (interruption by a signal), and distinguishing EOF (end of input) from an input error in perf_replies, while calling MHD_stop_daemon() correctly? This report concerns build warnings. An HTTP server crash or remote exploitation has not been established. Since these code paths are also present in earlier versions, this should not be described as a new regression in 1.0.10.

Thank you.
Best regards,
Vladimir Yavorsky
Software Engineer


Reply via email to