mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
vircommand: Parse /dev/fd on *BSD-like systems when looking for opened FDs
On BSD-like systems "/dev/fd" serves the same purpose as "/proc/self/fd". And since procfs is usually not mounted, on such systems we can use "/dev/fd" instead. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/518 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
4df8dc576f
commit
308ec0fb2c
@ -472,7 +472,7 @@ virExecCommon(virCommand *cmd, gid_t *groups, int ngroups)
|
||||
return 0;
|
||||
}
|
||||
|
||||
# ifdef __linux__
|
||||
# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
static int
|
||||
virCommandMassCloseGetFDsDir(virBitmap *fds,
|
||||
const char *dirName)
|
||||
@ -502,7 +502,7 @@ virCommandMassCloseGetFDsDir(virBitmap *fds,
|
||||
|
||||
return 0;
|
||||
}
|
||||
# endif /* __linux__ */
|
||||
# endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) */
|
||||
|
||||
static int
|
||||
virCommandMassCloseGetFDs(virBitmap *fds)
|
||||
@ -513,6 +513,8 @@ 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…
Reference in New Issue
Block a user