Cygwin: return better inode numbers for block device entries in /proc/sys

Commit 3434d35a64 fixed a problem when
accessing block devices via their /proc/sys/Device entries.  This
changed the way stat info is generated for these devices, resulting
in identical inode numbers for all block devices under /proc/sys/Device.

This patch fixes that by faking a device number for these devices, just as
before.

Fixes: 3434d35a64 ("Cygwin: Fix access to block devices below /proc/sys.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-08-19 16:08:34 +02:00
parent cf86601d98
commit ad35bfbb0f
1 changed files with 2 additions and 0 deletions

View File

@ -45,6 +45,8 @@ fhandler_dev_raw::fstat (struct stat *buf)
else
buf->st_mode = S_IFBLK | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
if (get_major () == DEV_SD_HIGHPART_END && get_minor () == 9999)
buf->st_ino = get_ino ();
buf->st_uid = geteuid32 ();
buf->st_gid = getegid32 ();
buf->st_nlink = 1;