From: Darafei Praliaskouski Date: Thu, 7 May 2026 21:37:10 +0000 (+0400) Subject: fix(cmdpipe): clarify mtr-packet startup failures X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=refs%2Fpull%2F601%2Fhead;p=thirdparty%2Fmtr.git fix(cmdpipe): clarify mtr-packet startup failures --- diff --git a/ui/cmdpipe.c b/ui/cmdpipe.c index bd5606a..73b868d 100644 --- a/ui/cmdpipe.c +++ b/ui/cmdpipe.c @@ -100,10 +100,15 @@ int send_synchronous_command( if (read_length < 0) { return -1; } + if (read_length == 0) { + errno = EPIPE; + return -1; + } /* Parse the query reply */ reply[read_length] = 0; if (parse_command(result, reply)) { + errno = EPROTO; return -1; } @@ -205,6 +210,17 @@ int check_packet_features( } +static +void fail_packet_startup( + int saved_errno) +{ + error(0, saved_errno, "Failure to start mtr-packet"); + error(EXIT_FAILURE, 0, + "mtr-packet did not answer the startup check; " + "check that it is installed and allowed to open probe sockets"); +} + + extern char *myname; /* Execute mtr-packet, allowing the MTR_PACKET environment to override @@ -313,7 +329,7 @@ int open_command_pipe( execute the mtr-packet binary, we will discover that here. */ if (check_feature(ctl, cmdpipe, "send-probe")) { - error(EXIT_FAILURE, errno, "Failure to start mtr-packet"); + fail_packet_startup(errno); } if (check_packet_features(ctl, cmdpipe)) {