delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/11/22:50:00

Date: Wed, 11 Sep 1996 22:47:59 -0400
From: dj (DJ Delorie)
Message-Id: <199609120247.WAA19006@delorie.com>
To: djgpp-workers
Subject: opendir again

I changed opendir to this diff instead of the previous one; this one
tries findfirst and only sets the fake-out bit if it doesn't return
".".

diff -r -c3 src/libc/posix/dirent/opendir.c /v2/src/libc/posix/dirent/opendir.c
*** src/libc/posix/dirent/opendir.c	Sat Aug 31 21:09:32 1996
--- /v2/src/libc/posix/dirent/opendir.c	Wed Sep 11 22:40:50 1996
***************
*** 34,39 ****
--- 34,51 ----
    /* Make absolute path */
    _fixpath(name, dir->name);
  
+   /* If we're doing opendir of the root directory, we need to
+      fake out the . and .. entries, as some unix programs (like
+      mkisofs) expect them and fail if they don't exist */
+   dir->need_fake_dot_dotdot = 0;
+   if (dir->name[1] == ':' && dir->name[2] == '/' && dir->name[3] == 0)
+   {
+     /* see if findfirst finds "." anyway */
+     int done = findfirst(dir->name, &dir->ff, FA_ARCH|FA_RDONLY|FA_DIREC|FA_SYSTEM);
+     if (done || strcmp(dir->ff.ff_name, "."))
+       dir->need_fake_dot_dotdot = 2;
+   }
+ 
    /* Ensure that directory to be accessed exists */
    if (access(dir->name, D_OK))
    {

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019