[Pkg-sysvinit-devel] Copying input file descriptor

Henrique de Moraes Holschuh hmh at debian.org
Wed Dec 28 17:26:41 UTC 2005


On Wed, 28 Dec 2005, Thomas Hood wrote:
> I just made this change so that checkroot.sh copies input file descriptors
> using the same syntax as mountvirtfs uses.  I thought I would draw your attention
> to this change in case there is something I'm missing.
> 
> --- debian/initscripts/etc/init.d/checkroot.sh  (revision 456)
> +++ debian/initscripts/etc/init.d/checkroot.sh  (working copy)
> @@ -53,7 +53,7 @@
>         # 3) The mount parameters for a devfs filesystem.
>         #
> 
> -       exec 9>&0 </etc/fstab
> +       exec 9<&0 </etc/fstab

The effect of that is:
  * stdin input (0) becomes /etc/fstab
  * descriptor 9 becomes what used to be stdin input before it became
    /etc/fstab

If that's what you want, then it is correct :)

> -       exec 0>&9 9>&-
> +       exec 0<&9 9<&-

And this restores stdin from descriptor 9, and closes descriptor 9.

Looks correct to me.

I have absolutely no idea how it worked before with >& instead of <&.  While
they actualy *do* the same thing if both fds are specified, the operand
order is reversed...

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh



More information about the Pkg-sysvinit-devel mailing list