mirror of
https://github.com/ipxe/ipxe.git
synced 2026-05-04 12:01:25 +02:00
[xferbuf] Silently discard data written to a void data transfer buffer
Allow data to be successfully written (and discarded) to a void data transfer buffer, rather than throwing an error. This allows a void data transfer buffer to be used when determining the length of a file downloaded from a TFTP server that does not support the "tsize" option defined in RFC 2349. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
3194c8ad0a
commit
b48965ae57
@ -129,13 +129,10 @@ int xferbuf_write ( struct xfer_buffer *xferbuf, size_t offset,
|
||||
if ( ( rc = xferbuf_ensure_size ( xferbuf, max_len ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Check that buffer is non-void */
|
||||
if ( len && ( ! xferbuf->data ) )
|
||||
return -ENOTTY;
|
||||
|
||||
/* Copy data to buffer */
|
||||
/* Copy data to buffer (if non-void) */
|
||||
profile_start ( &xferbuf_write_profiler );
|
||||
memcpy ( ( xferbuf->data + offset ), data, len );
|
||||
if ( xferbuf->data )
|
||||
memcpy ( ( xferbuf->data + offset ), data, len );
|
||||
profile_stop ( &xferbuf_write_profiler );
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user