Commit Graph
5 Commits
Author SHA1 Message Date
omrzk 0013f4fcf4 Report write errors from writesf(), writellf(), and writedf()
The write functions return success when nothing was written, e.g., on
a stream that is not open for writing:

    writesf("data", "r", "/tmp/file");

They return the result of fclose() and drop the one from fprintf().

Return -1 when fprintf() fails, with errno from the failed write.

Closes #25
2026-11-16 14:13:07 +01:00
omrzk 666a8ef7cd Honor the symbolic link option when copying files
Inspect source links without following them when COPYFILE_SYM is requested, before rejecting directories. This makes the documented option recreate link text instead of copying the referent, including dangling and directory links. Preserve requested link timestamps and report link-creation errors without overwriting the destination. Cover direct calls, destination directories, normal dereferencing and the existing rsync file caller.
2026-11-14 12:41:18 +01:00
omrzk 2dfc02e67d Preserve binary data when copying file streams
Copy the bytes returned by fread instead of treating each input chunk as a NUL-terminated string. Preserve the public stream positions and report read and write failures rather than returning success after a partial copy. Add binary boundary, current-position, native pipe error and full-device regression coverage.
2026-11-13 09:12:43 -06:00
Joachim Wiberg 92bb0ca399 runbg: new helper function inspired by the Infix project
The runbg() function is a delayed execvp() that has double-forked to the
background (to not create zombies).  It is useful for running commands
in the background for APIs that need to return a reply, e.g. a NETCONF
RPC to reboot the system.

Compared to the original in Infix, this version double forks to reparent
itself to PID 1 (init), closes all open files, including stdio.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-17 11:00:09 +02:00
Joachim Wiberg c9633ffbb0 Rename tests/ -> test/ and update internal refs.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 12:22:33 +02:00