mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Revert "vircommand: Parse /dev/fd on *BSD-like systems when looking for opened FDs"
Unfortunately, devfs on FreeBSD (accessible via /dev/fd) exposes only those FDs which can be represented as a file. To cite manpage [1]: The files /dev/fd/0 through /dev/fd/# refer to file descriptors which can be accessed through the file system. This means FDs representing pipes and/or unnamed sockets are not visible by default. To expose all FDs a slightly different filesystem must be mounted [2]: mount -t fdescfs none /dev/fd Apparently, on my test machine fdescfs is mounted by default and thus I haven't seen any problem. Only after aforementioned patch was merged our CI started reporting problems. While we could try to figure out whether correct FS is mounted, it's a needless micro optimization. Just revert the code to the state it was before I touched it. 1: https://man.freebsd.org/cgi/man.cgi?query=fd&sektion=4&manpath=freebsd-release-ports 2: https://man.freebsd.org/cgi/man.cgi?query=fdescfs&sektion=5&n=1 This reverts commit 308ec0fb2c77f4867179f00c628f05d1d784f370. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
308ec0fb2c
commit
ebc4580a5f
@ -472,7 +472,7 @@ virExecCommon(virCommand *cmd, gid_t *groups, int ngroups)
|
||||
return 0;
|
||||
}
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
# ifdef __linux__
|
||||
static int
|
||||
virCommandMassCloseGetFDsDir(virBitmap *fds,
|
||||
const char *dirName)
|
||||
@ -502,7 +502,7 @@ virCommandMassCloseGetFDsDir(virBitmap *fds,
|
||||
|
||||
return 0;
|
||||
}
|
||||
# endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) */
|
||||
# endif /* __linux__ */
|
||||
|
||||
static int
|
||||
virCommandMassCloseGetFDs(virBitmap *fds)
|
||||
@ -513,8 +513,6 @@ virCommandMassCloseGetFDs(virBitmap *fds)
|
||||
* onto child process (well, the one we will exec soon since this
|
||||
* is called from the child). */
|
||||
return virCommandMassCloseGetFDsDir(fds, "/proc/self/fd");
|
||||
# elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
return virCommandMassCloseGetFDsDir(fds, "/dev/fd");
|
||||
# else
|
||||
virBitmapSetAll(fds);
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user