MSYS2-packages/coreutils/coreutils-8.32-src-pwd.c.patch
مهدي شينون (Mehdi Chinoune) ddf66eac75 coreutils: update to 9.4
patches were copied from CygWin.
2023-09-20 07:21:31 +01:00

33 lines
1.1 KiB
Diff

--- origsrc/src/pwd.c 2016-11-06 16:15:30.000000000 -0600
+++ src/src/pwd.c 2017-02-03 13:32:48.756816900 -0600
@@ -269,8 +269,8 @@ static void
robust_getcwd (struct file_name *file_name)
{
size_t height = 1;
- struct dev_ino dev_ino_buf;
- struct dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
+ struct root_dev_ino dev_ino_buf;
+ struct root_dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
struct stat dot_sb;
if (root_dev_ino == NULL)
@@ -283,7 +283,7 @@ robust_getcwd (struct file_name *file_na
while (1)
{
/* If we've reached the root, we're done. */
- if (SAME_INODE (dot_sb, *root_dev_ino))
+ if (ROOT_DEV_INO_CHECK (root_dev_ino, &dot_sb))
break;
find_dir_entry (&dot_sb, file_name, height++);
@@ -292,6 +292,9 @@ robust_getcwd (struct file_name *file_na
/* See if a leading slash is needed; file_name_prepend adds one. */
if (file_name->start[0] == '\0')
file_name_prepend (file_name, "", 0);
+ /* If we aren't in `/', we must be in `//'. */
+ if (! SAME_INODE (root_dev_ino->single_slash, dot_sb))
+ file_name_prepend (file_name, "", 0);
}