[CRIU] [PATCH 05/15] img: Use errno when checking optional images open fail

Pavel Emelyanov xemul at parallels.com
Mon Sep 29 03:14:05 PDT 2014


On 09/29/2014 02:12 PM, Andrew Vagin wrote:
> On Mon, Sep 29, 2014 at 12:47:54PM +0400, Pavel Emelyanov wrote:
>> There will be no int-fd soon, so one more preparation
>> to this fact.
>>
>> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
>> ---
>>  cr-restore.c | 4 ++--
>>  file-lock.c  | 2 +-
>>  files.c      | 4 ++--
>>  irmap.c      | 2 +-
>>  mem.c        | 2 +-
>>  protobuf.c   | 2 +-
>>  6 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/cr-restore.c b/cr-restore.c
>> index 9277433..ae083e8 100644
>> --- a/cr-restore.c
>> +++ b/cr-restore.c
>> @@ -2354,7 +2354,7 @@ static int prepare_rlimits_from_fd(int pid)
>>  	 */
>>  	fd = open_image(CR_FD_RLIMIT, O_RSTR | O_OPT, pid);
>>  	if (fd < 0) {
>> -		if (fd == -ENOENT) {
>> +		if (errno == ENOENT) {
> 
> I don't like this. errno can be rewritten by any glibc call.

Sure it can, but currently open_image behaves "correctly". We can
pin this as a requirement for further patches.

Thanks,
Pavel




More information about the CRIU mailing list