[libvirt] [PATCH] qemuDomainAttachDeviceMknodHelper: Remove symlink before creating it
Andrea Bolognani
abologna at redhat.com
Fri Jan 5 11:29:30 UTC 2018
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.
Either way:
Reviewed-by: Andrea Bolognani <abologna at redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list