comparison src/fileio.c @ 13902:31e37f3d8ccd

(Ffile_readable_p) [MSDOS]: Use access rather than open.
author Richard M. Stallman <rms@gnu.org>
date Sun, 31 Dec 1995 19:49:39 +0000
parents a17778d3f5f3
children 621a575db6f7
comparison
equal deleted inserted replaced
13901:c9243845a191 13902:31e37f3d8ccd
2458 call the corresponding file handler. */ 2458 call the corresponding file handler. */
2459 handler = Ffind_file_name_handler (abspath, Qfile_readable_p); 2459 handler = Ffind_file_name_handler (abspath, Qfile_readable_p);
2460 if (!NILP (handler)) 2460 if (!NILP (handler))
2461 return call2 (handler, Qfile_readable_p, abspath); 2461 return call2 (handler, Qfile_readable_p, abspath);
2462 2462
2463 #ifdef MSDOS
2464 /* Under MS-DOS, open does not work't right, because it doesn't work for
2465 directories (MS-DOS won't let you open a directory). */
2466 if (access (XSTRING (abspath)->data, 0) == 0)
2467 return Qt;
2468 return Qnil;
2469 #else /* not MSDOS */
2463 desc = open (XSTRING (abspath)->data, O_RDONLY); 2470 desc = open (XSTRING (abspath)->data, O_RDONLY);
2464 if (desc < 0) 2471 if (desc < 0)
2465 return Qnil; 2472 return Qnil;
2466 close (desc); 2473 close (desc);
2467 return Qt; 2474 return Qt;
2475 #endif /* not MSDOS */
2468 } 2476 }
2469 2477
2470 /* Having this before file-symlink-p mysteriously caused it to be forgotten 2478 /* Having this before file-symlink-p mysteriously caused it to be forgotten
2471 on the RT/PC. */ 2479 on the RT/PC. */
2472 DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, 2480 DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,