Re: [PATCH] loopdev: fix losetup failure with a lost device file

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

 



 Hi Junxiao,

On Thu, Oct 12, 2023 at 02:55:24PM -0700, Junxiao Bi wrote:
> +	sprintf(path, "/dev/loop%d", nr);
> +	/* default loop device permission is "brw-rw----" */
> +	umask(0003);
> +	ret = mknod(path, S_IFBLK|0660, makedev(major, minor));
> +	if (ret)
> +		return -1;

frankly, it will be challenging to convince me that using mknode in a
tool like losetup is a good idea. After all these decades, it's still
not a common practice (although I have see many attempts).  Nodes are
typically created by udevd by default, following udev rules.

IMHO, it's better to report the problem (perhaps with a helpful hint)
as error message and assume that the administrator will address it.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[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