From 144706342f218a8abba6159be2ef42c94e91a1ca Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 12 May 2025 12:33:35 +0200 Subject: [PATCH] tests/server: check for `stream != NULL` in mqttd To avoid an assert in `fgets()` on MSVC when the test case is missing. Bug: https://github.com/curl/curl/pull/17294#issuecomment-2867501300 Closes #17324 --- tests/server/mqttd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index 744517077c..4fdc67c8af 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -583,6 +583,12 @@ static curl_socket_t mqttit(curl_socket_t fd) logmsg("SUBSCRIBE to '%s' [%d]", topic, packet_id); stream = test2fopen(testno, logdir); + if(!stream) { + error = errno; + logmsg("fopen() failed with error (%d) %s", error, strerror(error)); + logmsg("Couldn't open test file %ld", testno); + goto end; + } error = getpart(&data, &datalen, "reply", "data", stream); if(!error) { if(!m_config.publish_before_suback) { -- 2.47.3