Make sox_close() return the result of xfclose() #619

Open
opened 2025-09-16 12:38:18 +00:00 by martinwguy · 0 comments
martinwguy commented 2025-09-16 12:38:18 +00:00 (Migrated from codeberg.org)

Make sox_close() return the result of xfclose()

Description

sox_close() ignores the result of xfclose(), which calls fclose() or pclose()
and returns their return values (fclose returns 0 or -1 like SOX_SUCCESS and SOX_EOF,
and pclose returns the exit status of the command, which is also 0 on success).

If we were to apply

-    xfclose(ft->fp, ft->io_type);
+    result = xfclose(ft->fp, ft->io_type);

that would make it signal a write error of buffered data when the disk is full,
or a piped command failing when it should have succeeded.

# Make sox_close() return the result of xfclose() ## Description `sox_close()` ignores the result of `xfclose()`, which calls `fclose()` or `pclose()` and returns their return values (`fclose` returns 0 or -1 like SOX_SUCCESS and SOX_EOF, and `pclose` returns the exit status of the command, which is also 0 on success). If we were to apply ``` - xfclose(ft->fp, ft->io_type); + result = xfclose(ft->fp, ft->io_type); ``` that would make it signal a write error of buffered data when the disk is full, or a piped command failing when it should have succeeded.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martinwguy/sox_ng#619
No description provided.