[pve-devel] [PATCH storage] api: upload: correctly test for result of unlink

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jul 29 18:50:26 CEST 2024


Am 29/07/2024 um 16:29 schrieb Fiona Ebner:
> It's not enough to check whether $! is set. From "perldoc perlvar":
> 
>> Many system or library calls set "errno" if they fail, to
>> indicate the cause of failure. They usually do not set "errno"
>> to zero if they succeed and may set "errno" to a non-zero value
>> on success. This means "errno", hence $!, is meaningful only
>> *immediately* after a failure:
> 
> To protect against potential issues, check the return value of unlink
> and only check $! if it failed.

fine by me, but out of interest: any reason for why this is done now,
i.e., did this really cause trouble or is this done out of precaution?




More information about the pve-devel mailing list