[PATCH] Add get_current_dir_name(3)

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Sun Jan 1 07:13:00 GMT 2012


On Sun, 2012-01-01 at 01:46 -0500, Christopher Faylor wrote:
> On Sat, Dec 31, 2011 at 08:45:07PM -0600, Yaakov (Cygwin/X) wrote:
> >+extern "C" char *
> >+get_current_dir_name (void)
> >+{
> >+  char *pwd = getenv ("PWD");
> >+  char *cwd = getcwd (NULL, 0);
> >+
> >+  if (pwd)
> >+    {
> >+      struct __stat64 pwdbuf, cwdbuf;
> >+      stat64 (pwd, &pwdbuf);
> >+      stat64 (cwd, &cwdbuf);
> >+      if (pwdbuf.st_ino == cwdbuf.st_ino)
> 
> You have to check st_dev here too don't you?

Of course.  Revised patch for winsup/cygwin attached.


Yaakov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-get_current_dir_name.patch
Type: text/x-patch
Size: 2972 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20120101/9b23cdc8/attachment.bin>


More information about the Cygwin-patches mailing list