diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-02-28 12:52:04 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-02-29 06:35:01 +0100 |
commit | dda7945ca9c9d2371fc37cfaed688f92bd627224 (patch) | |
tree | b23b211da253b4a95bf0b1cd22941036ae71c04a /util.h | |
parent | 8bdb0883b441441590589aac46f991c80e4f80f3 (diff) | |
download | passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.tar passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.tar.gz passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.tar.bz2 passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.tar.lz passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.tar.xz passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.tar.zst passt-dda7945ca9c9d2371fc37cfaed688f92bd627224.zip |
pcap: Handle short writes in pcap_frame()
Currently pcap_frame() assumes that if write() doesn't return an error, it
has written everything we want. That's not necessarily true, because it
could return a short write. That's not likely to happen on a regular file,
but there's not a lot of reason not to be robust here; it's conceivable we
might want to direct the pcap fd at a named pipe or similar.
So, make pcap_frame() handle short frames by using the write_remainder()
helper.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Formatting fix, and avoid gcc warning in pcap_frame()]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
0 files changed, 0 insertions, 0 deletions