losetup race condition

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

 



losetup provides an -f option to discover an unused loop device.  As
implemented, it is racy.

The problem is that -f prints the loop device to stdout only when used
standalone.  This means a script has to do:

lodev=`losetup -f`
losetup $lodev $filename

... which is racy if another script may be running.  The syntax:

lodev=`losetup -f $filename`

... doesn't work, because although it will set up the loop device for
you (and it better do it atomically!), it never prints out the selected
loop device for the script to use.

	-hpa
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux