Re: [PATCH 1/2] unpack-trees: handle lstat failure for existing directory

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

 



Miles Bader wrote:
> Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

>> @@ -1382,7 +1382,9 @@ static int verify_absent_1(struct cache_entry *ce,
>>  		return check_ok_to_remove(ce->name, ce_namelen(ce),
>>  				ce_to_dtype(ce), ce, &st,
>>  				error_type, o);
>> -
>> +	if (errno != ENOENT)
>> +		return error("cannot stat '%s': %s", ce->name,
>> +				strerror(errno));
>>  	return 0;
>
> Is errno guaranteed to be set to something relevant at this point in the
> code...?

Yes, because lstat failed.  But perhaps that is a hint that the code
should be restructured as

	} else if (lstat(... )) {
		if (errno != ENOENT)
			return error(...
		return 0;
	} else {
		return check_ok_to_remove(...
	}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]