Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Sender: fujieda AT elbereth DOT jaist DOT ac DOT jp To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: different files have the same i-node number. Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII From: Kazuhiro Fujieda Date: 19 May 1999 18:47:09 +0900 Message-ID: Lines: 82 X-Mailer: Gnus v5.3/Emacs 19.34 In recent snapshots, different files sometime have the same i-node number on Win9x. This is caused by the following code in fhandler.cc. 882: buf->st_ino = local.nFileIndexHigh | local.nFileIndexLow; This value isn't quiet unique on Win9x, so i-node should be based on a hash number like the past snapshots on Win9x. --- fhandler.cc- Thu Mar 25 12:22:46 1999 +++ fhandler.cc Wed May 19 17:28:14 1999 @@ -879,7 +879,11 @@ fhandler_disk_file::fstat (struct stat * buf->st_nlink = local.nNumberOfLinks; buf->st_dev = local.dwVolumeSerialNumber; buf->st_size = local.nFileSizeLow; - buf->st_ino = local.nFileIndexHigh | local.nFileIndexLow; + if (os_being_run == winNT) + /* This is not unique on Win9x */ + buf->st_ino = local.nFileIndexHigh | local.nFileIndexLow; + else + buf->st_ino = local.nFileIndexLow ^ get_namehash (); buf->st_blksize = S_BLKSIZE; buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE; buf->st_uid = get_file_owner (get_win32_name ()); By the way, conditional branches about file types in stat_worker() are a little tedious and not intuitive. They can be more simple. --- syscalls.cc- Wed Mar 10 07:30:18 1999 +++ syscalls.cc Wed May 19 17:34:08 1999 @@ -1215,24 +1215,7 @@ stat_worker (const char *caller, const c drive[0] = win32_name[0]; UINT dtype; - if (os_being_run == winNT - && (!(atts & FILE_ATTRIBUTE_DIRECTORY) - || ((dtype = GetDriveType (drive)) != DRIVE_NO_ROOT_DIR - && dtype != DRIVE_REMOTE - && dtype != DRIVE_UNKNOWN))) - { - fhandler_disk_file fh (NULL); - - if (fh.open (real_path, O_RDONLY | O_BINARY | O_DIROPEN | - (nofollow ? O_NOSYMLINK : 0), 0)) - { - res = fh.fstat (buf); - fh.close (); - if (atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY)) - buf->st_nlink = num_entries (win32_name); - } - } - else if (atts == -1 || !(atts & FILE_ATTRIBUTE_DIRECTORY)) + if (atts == -1 || !(atts & FILE_ATTRIBUTE_DIRECTORY)) { fhandler_disk_file fh (NULL); @@ -1242,6 +1225,21 @@ stat_worker (const char *caller, const c res = fh.fstat (buf); fh.close (); } + } + else if (os_being_run == winNT + && ((dtype = GetDriveType (drive)) != DRIVE_NO_ROOT_DIR + && dtype != DRIVE_REMOTE + && dtype != DRIVE_UNKNOWN)) + { + fhandler_disk_file fh (NULL); + + if (fh.open (real_path, O_RDONLY | O_BINARY | O_DIROPEN | + (nofollow ? O_NOSYMLINK : 0), 0)) + { + res = fh.fstat (buf); + fh.close (); + buf->st_nlink = num_entries (win32_name); + } } else { ____ | AIST Kazuhiro Fujieda | HOKURIKU School of Information Science o_/ 1990 Japan Advanced Institute of Science and Technology