Bug: Transfer functions return -1, causing implementation-defined exit status #164

Closed
opened 2026-07-29 18:35:48 +02:00 by TapTap · 0 comments
Owner

Description

send_files() and send_files_multithreaded() return -1 on failure. client_cli.c then returns this value directly from main(). Returning a negative value from main() is implementation-defined behavior (typically the lower 8 bits are interpreted as an unsigned exit code, so -1 becomes 255, but this is not portable or intentional).

Location

  • src/client/client_send.c:230-232, 426, 485
  • src/client/client_cli.c:305return exit_code; where exit_code may be -1.

Suggested fix

  1. Define clear exit codes: 0 for success, 1 for general error, 2 for network/config error, etc.
  2. Return 1 (or a named constant) instead of -1 from the transfer functions.

Severity

Medium

Category

bug


This issue was automatically generated by the issue-creator agent.

## Description `send_files()` and `send_files_multithreaded()` return `-1` on failure. `client_cli.c` then returns this value directly from `main()`. Returning a negative value from `main()` is implementation-defined behavior (typically the lower 8 bits are interpreted as an unsigned exit code, so `-1` becomes 255, but this is not portable or intentional). ## Location - `src/client/client_send.c:230-232`, `426`, `485` - `src/client/client_cli.c:305` — `return exit_code;` where `exit_code` may be `-1`. ## Suggested fix 1. Define clear exit codes: `0` for success, `1` for general error, `2` for network/config error, etc. 2. Return `1` (or a named constant) instead of `-1` from the transfer functions. ## Severity Medium ## Category bug --- _This issue was automatically generated by the issue-creator agent._
TapTap added the bugqualityneeds-triage labels 2026-07-29 18:35:48 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#164