[Toybox] Fix ftpget tool get command exit with error code 1

更好的自己 jo273175093 at 163.com
Sat May 17 06:38:14 PDT 2025


Hi Maintainers,

ftpget tool use with get command like: "ftpget 192.168.0.123 /data/test.txt test.txt" will exit with error code 1 instead of 0.
I check the code flow in "ftp_line" function, it will enter "error_exit_raw" because "rc != must (must==226)".

The ftpget needs to receive a 150 status code from the server before proceeding to receive actual data, then followed by get 226 status code before sending the "QUIT" command.
The implementation in BusyBox 1.35.0 (networking/ftpgetput.c, lines 233(ftp_receive) and 183(pump_data_and_QUIT)) follows this logic, allowing it to successfully send "QUIT" and exit without errors.

With this patch applied, the message like: "150 Opening BINARY mode data connection for test.txt (10 bytes)" will no longer be misinterpreted as an error. The program can then exit with code 0 instead of 1.


BTW, I also created Pull requests on GitHub.


Thanks.
Best regards
Hongsheng Peng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20250517/000475cd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-ftpget-tool-exit-with-error-code-1.patch
Type: application/octet-stream
Size: 1247 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20250517/000475cd/attachment.obj>


More information about the Toybox mailing list