about getcwd

Tu Juan jtu at utstar.com
Wed Sep 5 22:27:39 UTC 2001


Anyone who can help me to explain these problems in getcwd().

      /*
       * If it's a mount point, have to stat each element because
       * the inode number in the directory is for the entry in the
       * parent directory, not the inode number of the mounted file.
       */

 save_errno = 0;
 if (s.st_dev == dev)// When use this, it's not work. 
 {
   for (;;)
     {
       if (!(dp = _readdir (dir)))
          goto notfound;
       if (dp->d_ino == ino) // dp->d_ino is always be 1. It has been set in imfs_dir_read (imfs_directory.c).
          break;
     }
 }
 else // This is work.
 for (;;)
   {
     if (!(dp = _readdir (dir)))
       goto notfound;
     if (ISDOT (dp))
       continue;
     bcopy (dp->d_name, bup, strlen (dp->d_name) + 1);

     /* Save the first error for later. */
     if (stat (up, &s))
       {
          if (!save_errno)
            save_errno = errno;
          errno = 0;
          continue;
       }
     if (s.st_dev == dev && s.st_ino == ino)
       break;
   }

Thanks,

Tu Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20010905/00dbb3db/attachment.html>


More information about the users mailing list