ndhc/nk
Nicholas J. Kain f7db9fd5e7
Correct regression introduced by previous commit.
safe_recv(..., len), when used on a blocking fd, will attempt
to call recv and collect data until either EOF, a hard error,
or len bytes are collected.

The previous commit used safe_recv() in a blocking mode to read
a single byte into a buffer that was larger than a byte.  This
would cause ndhc to stall as safe_recv() would try to fill that
buffer when no more data would ever be sent.

This issue would only happen if ndhc is supposed to run a script.

Introduce and use safe_recv_once() that will correct this problem and
fill the semantic gap for blocking fds.  I add a new call because in
some cases the above behavior might be required for a blocking fd, too.

Note that the above issue is not a problem for nonblocking fds; the
EAGAIN or EWOULDBLOCK path will return a short read.
2022-09-07 17:08:43 -04:00
..
hwrng.c Use the HWRNG for generating DUIDs and IAIDs. 2022-08-28 04:00:06 -04:00
hwrng.h Use the HWRNG for generating DUIDs and IAIDs. 2022-08-28 04:00:06 -04:00
io.c Correct regression introduced by previous commit. 2022-09-07 17:08:43 -04:00
io.h Correct regression introduced by previous commit. 2022-09-07 17:08:43 -04:00
log.h Relicense as MIT. 2022-02-06 20:05:29 -05:00
net_checksum16.h Relicense as MIT. 2022-02-06 20:05:29 -05:00
privs.c privs: Don't use libc isdigit() 2022-08-27 10:29:11 -04:00
privs.h Relicense as MIT. 2022-02-06 20:05:29 -05:00
pspawn.c Use memccpy() and memcpy() instead of nstr{cpy,lcpy,cat}. 2022-08-27 04:11:12 -04:00
pspawn.h scriptd: Use posix_spawn rather than fork/exec. 2022-08-09 13:40:10 -04:00
random.c Use the HWRNG for generating DUIDs and IAIDs. 2022-08-28 04:00:06 -04:00
random.h Relicense as MIT. 2022-02-06 20:05:29 -05:00