Re: [PATCH 2/2] virpcimock: Mock __open_2()

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

 



On Thu, Aug 15, 2019 at 05:15:57PM +0200, Michal Privoznik wrote:
> Hold on to your hat, this is going to be a wild ride. As nearly
> nothing in glic, nor open() is a real function. Just look into
> bits/fcntl2.h and you'll see that open() is actually a thin
> wrapper that calls either __open_alias() or __open_2(). Now,
> before 801ebb5edb6 the open() done in
> virPCIDeviceConfigOpenInternal() had a constant oflags (we were
> opening the pci config with O_RDWR). And since we were not
> passing any mode nor O_CREAT the wrapper decided to call
> __open_alias() which was open() provided by our mock. So far so
> good. But after the referenced commit, the oflags is no longer
> compile time constant and therefore the wrapper calls __open_2()
> which we don't mock and thus the real __open_2() from glibc was
> called and thus we did try to open real path from host's /sys.
> This of course fails with variety of errors.
>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---

Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

--
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