Re: [PATCH] qemuDomainAttachDeviceMknodHelper: Remove symlink before creating it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/05/2018 12:29 PM, Andrea Bolognani wrote:
> On Fri, 2018-01-05 at 12:14 +0100, Andrea Bolognani wrote:
>>>      if (isLink) {
>>>          VIR_DEBUG("Creating symlink %s -> %s", data->file, data->target);
>>> +
>>> +        /* First, unlink the symlink target. Symlinks change and
>>> +         * therefore we have no guarantees that pre-existing
>>> +         * symlink is still valid. */
>>> +        if (unlink(data->file) < 0 &&
>>
>> Here...
>>
>>> +            errno != ENOENT) {
>>> +            virReportSystemError(errno,
>>> +                                 _("Unable to remove symlink %s"),
>>> +                                 data->file);
>>
>> ... and here, shouldn't you be using data->target instead
>> of data->file?
> 
> Never mind, you got it right and I clearly need more coffee :)
> 
> However, later on:
> 
>>> +            virReportSystemError(errno,
>>> +                                 _("Unable to create symlink %s"),
>>> +                                 data->target);
>>> +            goto cleanup;
> 
> You should use data->file here to be consistent.

How about:

_("Unable to create symlink %s -> %s"), data->target, data->file

Here and above.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux