several changes today

Andreas Jaeger aj@arthur.rhein-neckar.de
Fri Oct 16 23:31:00 GMT 1998


>>>>> Ulrich Drepper writes:

Uli> I've also added O_DIRECTORY and while doing this found that the
Uli> various bits/fcntl.h files are no really acurate.  Could you please
Uli> examine the files for your platform (ix86 should be ok now).
I've just one question about the status of O_DIRECTORY.  O_DIRECTORY
is so far only available in Linux 2.1.126pre1 but you defined
O_DIRECTORY unconditonally to get used on all versions of Linux

Will the code in opendir code (appended below) cause problems on older
systems (where O_DIRECTORY is defined via libc but not known to the
kernel)?  Do we have to force people using Linux 2.1.126+ as headers
and running kernel for glibc 2.1?

Andreas

/* We want to be really safe the file we opened is a directory.  Some systems
   have support for this, others don't.  */
#ifdef O_DIRECTORY
# define OPENDIR(NAME) \
  do {                                                                       \
    fd = __open (NAME, O_RDONLY|O_NDELAY|O_DIRECTORY);                       \
    if (fd < 0)                                                                
     \
      return NULL;                                                           \
  } while (0)
#else
# define OPENDIR(NAME) \
  do {                                                                       \
    fd = __open (NAME, O_RDONLY|O_NDELAY);                                   \
    if (fd < 0 || __fstat (fd, &statbuf) < 0 || ! S_ISDIR (statbuf.st_mode))  \
      {                                                                        
     \
       if (fd >= 0)                                                          \
         __close (fd);                                                       \
       return NULL;                                                          \
      }                                                                        
     \
  } while (0)
#endif
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de



More information about the Libc-hacker mailing list