]> xenbits.xensource.com Git - xen.git/commit
tools/ocaml: Dup2 /dev/null to stdin in daemonize()
authorChristian Lindig <christian.lindig@citrix.com>
Wed, 27 Feb 2019 10:33:42 +0000 (10:33 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 16 May 2019 16:00:15 +0000 (17:00 +0100)
commit5cfbc0ffd563a2ee3abfcce74eb3c20d82a7a035
tree1471b072cbb25a22199fa5f1d294b462abc2e35c
parentc1c95c4d38ae2abc82c7d2277102e614fd76dbf5
tools/ocaml: Dup2 /dev/null to stdin in daemonize()

Don't close stdin in daemonize() but dup2 /dev/null instead.  Otherwise, fd 0
gets reused later:

  [root@idol ~]# ls -lav /proc/`pgrep xenstored`/fd
  total 0
  dr-x------ 2 root root  0 Feb 28 11:02 .
  dr-xr-xr-x 9 root root  0 Feb 27 15:59 ..
  lrwx------ 1 root root 64 Feb 28 11:02 0 -> /dev/xen/evtchn
  l-wx------ 1 root root 64 Feb 28 11:02 1 -> /dev/null
  l-wx------ 1 root root 64 Feb 28 11:02 2 -> /dev/null
  lrwx------ 1 root root 64 Feb 28 11:02 3 -> /dev/xen/privcmd
  ...

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
(cherry picked from commit 677e64dbe315343620c3b266e9eb16623b118038)
(cherry picked from commit 4b72470175a592fb5c0a5d10ed505de73778e10f)
tools/ocaml/xenstored/stdext.ml