------- Comment #4 from toon at moene dot org  2009-09-17 19:57 -------
In response to reply 2 (thanks Steve), we might be able to exploit the system
call access to at least solve the inconsistency between INQUIRE and OPEN:

man 2 access

       ENOENT A component of pathname does not exist or is a dangling symbolic
              link.

IOW, if we check for this (instead of requesting a stat buffer), we might be
able to answer the question consistently with OPEN.

See libgfortran/io/unix.c:

   1376 /* file_exists()-- Returns nonzero if the current filename exists on
   1377  * the system */
   1378 
   1379 int
   1380 file_exists (const char *file, gfc_charlen_type file_len)
   1381 {
   1382   char path[PATH_MAX + 1];
   1383   struct stat statbuf;
   1384 
   1385   if (unpack_filename (path, file, file_len))
   1386     return 0;
   1387 
   1388   if (stat (path, &statbuf) < 0)
   1389     return 0;
   1390 
   1391   return 1;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41387

Reply via email to