Bug 13351

Summary: wget with a redirection truncates the file to 0 bytes when it receives an empty response from the server
Product: Busybox Reporter: Héctor Molinero Fernández <hector>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.32.x   
Target Milestone: ---   
Hardware: All   
OS: All   
Host: Target:
Build:
Attachments: Sample script that replicates the issue

Description Héctor Molinero Fernández 2020-12-02 22:19:43 UTC
Created attachment 8691 [details]
Sample script that replicates the issue

When wget is invoked with a stdout redirection to a file and receives an empty response from the server the destination file is truncated to 0 bytes. This is caused by ftruncate being called with length 0.
Comment 1 Denys Vlasenko 2020-12-08 18:07:11 UTC
Fixed in git.