[CRIU] [PATCH] zdtm: Pick up deleted unix socket test
Filipe Brandenburger
filbranden at google.com
Thu Jul 3 08:58:57 PDT 2014
On Thu, Jul 3, 2014 at 7:34 AM, Pavel Emelyanov <xemul at parallels.com> wrote:
> + cwd = get_current_dir_name();
> + if (strlen(filename) + strlen(cwd) >= sizeof(name->sun_path))
> return -1;
This is now more likely to fail due to the fairly short limit on the
file name (108 bytes IIRC). Any chance this could fallback to
something like "/tmp" or getenv("TMPDIR") if the resulting pathname is
too long?
Alternatively, you could check if filename is an absolute path and not
prepend cwd in that case (or just fail altogether) and leave the job
to find an adequate filename to the script that calls it.
(BTW, there's also an off-by-one error in the length check now since
you're adding an extra "/" to the string. You probably want a +1 in
the lengths there. A maybe more flexible approach is using snprintf
and checking if the return value is >= the size of the string in which
case it means it was truncated.)
Cheers,
Filipe
More information about the CRIU
mailing list