Re: [PATCH] metadump/restore: don't use errno after fwrite/fread failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 3/21/18 6:58 PM, Darrick J. Wong wrote:
> On Wed, Mar 21, 2018 at 06:24:09PM -0500, Eric Sandeen wrote:
>> fread/fwrite don't set errno, so printing out strerror(errno)
>> after a failure leads to incorrect and confusing messages:
>>
>> # xfs_mdrestore pre_repair.meta pre_repair.img
>> xfs_mdrestore: error reading from file: Success
>>
>> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
>> ---
>>
>> diff --git a/db/metadump.c b/db/metadump.c
>> index 9d62958..231adc6 100644
>> --- a/db/metadump.c
>> +++ b/db/metadump.c
>> @@ -161,7 +161,7 @@ write_index(void)
>>  	 */
>>  	metablock->mb_count = cpu_to_be16(cur_index);
>>  	if (fwrite(metablock, (cur_index + 1) << BBSHIFT, 1, outf) != 1) {
>> -		print_warning("error writing to file: %s", strerror(errno));
>> +		print_warning("error writing to target file");
>>  		return -errno;
> 
> return -1?

Oh derp.
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux