[CRIU] [PATCH 4/N] crtools: resolve work_dir and imgs_dir path to absolute
Ruslan Kuprieiev
kupruser at gmail.com
Fri Nov 15 10:58:38 PST 2013
On 15.11.2013 18:26, Pavel Emelyanov wrote:
>>>> @@ -163,13 +165,20 @@ int main(int argc, char *argv[])
>>>> opts.restore_detach = true;
>>>> break;
>>>> case 'D':
>>>> - if (chdir(optarg)) {
>>>> - pr_perror("Can't change directory to %s",
>>>> - optarg);
>>>> + imgs_dir = xmalloc(PATH_MAX);
>>>> + imgs_dir = realpath(optarg, imgs_dir);
>>> NAK. Image dir should be passed into open_image_dir() as is.
>>>
>>>> + if (!imgs_dir) {
>>>> + pr_perror("Bad images directory path");
>>>> return -1;
>>>> }
>>>> break;
>>>> case 'W':
>>>> + work_dir = xmalloc(PATH_MAX);
>>>> + work_dir = realpath(optarg, work_dir);
>>> Same for work dir -- we should chrdir into what user gave us, not
>>> to somehow converted path.
>> Why? Isn't it comfortable to use relative to cwd paths for work and
>> images dirs?
> It is.
>
>> We chdir into what user gave us, but we convert relative into full paths
>> to not mess around with relative paths.
> This conversion is pointless and in some corner cases leads to wrong results.
Ok, i see. I had a problem with opened current directory with daemon
server. And I tried to make smth strange to solve this in an exotic (aka
stupid) way =). Thanks.
More information about the CRIU
mailing list