[CRIU] [PATCH 4/4] net: Make sure the entries exist before read them

Pavel Emelyanov xemul at parallels.com
Tue May 5 04:43:16 PDT 2015


On 05/05/2015 02:21 PM, Cyrill Gorcunov wrote:
> On Tue, May 05, 2015 at 02:16:33PM +0300, Pavel Emelyanov wrote:
>>> +
>>> +	dir = open("/proc/sys/" NET_CONF_PATH "/all", O_RDONLY);
>>> +	if (dir < 0) {
>>> +		pr_perror("Can't open sysctl dir");
>>> +		return -1;
>>> +	}
>>> +
>>> +	for (i = 0; i < ARRAY_SIZE(devconfs); i++) {
>>
>> Can we, instead of this loop, teach sysctl.c to handle missing entries
>> itself?
> 
> I thought about it, but this cause too many code changes in sysct
> code, so i think it should be up to a caller to test if entries
> are readable.

OK, then add CTL_CHECK op and re-use sysctl's /proc/sys opening and
loop anyway.

-- Pavel



More information about the CRIU mailing list