[CRIU] [PATCH 1/3] zdtm: Get dir of init.pid file
Pavel Emelyanov
xemul at virtuozzo.com
Wed Mar 9 01:49:35 PST 2016
On 03/02/2016 06:41 PM, Cyrill Gorcunov wrote:
> On Wed, Mar 02, 2016 at 06:22:08PM +0300, Pavel Emelyanov wrote:
>> diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
>> index bc5c395..78cc91c 100644
>> --- a/test/zdtm/lib/ns.c
>> +++ b/test/zdtm/lib/ns.c
>> @@ -239,7 +239,7 @@ int ns_init(int argc, char **argv)
>> .sa_flags = SA_RESTART,
>> };
>> int ret, fd, status_pipe = STATUS_FD;
>> - char buf[128];
>> + char buf[128], *x;
>> pid_t pid;
>>
>> ret = fcntl(status_pipe, F_SETFD, FD_CLOEXEC);
>> @@ -257,6 +257,10 @@ int ns_init(int argc, char **argv)
>> exit(1);
>> }
>>
>> + x = malloc(strlen(pidfile) + 3);
>> + sprintf(x, "%sns", pidfile);
>> + pidfile = x;
>> +
>
> Are you sure that malloc never fail here?
I'm pretty sure it is. This code runs on host with unlimited resources.
More information about the CRIU
mailing list