[BACK]Return to compat_fts.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/compat_fts.c between version 1.2 and 1.5

version 1.2, 2014/08/11 03:19:39 version 1.5, 2014/12/11 09:05:01
Line 1 
Line 1 
 #include "config.h"  #include "config.h"
   
 #ifdef HAVE_FTS  #if HAVE_FTS
   
 int dummy;  int dummy;
   
 #else  #else
   
   /*      $Id$    */
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
   
 /*-  /*-
Line 145  fts_open(char * const *argv, int options, void *dummy)
Line 146  fts_open(char * const *argv, int options, void *dummy)
          * and ".." are all fairly nasty problems.  Note, if we can't get the           * and ".." are all fairly nasty problems.  Note, if we can't get the
          * descriptor we run anyway, just more slowly.           * descriptor we run anyway, just more slowly.
          */           */
         if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)          if (!ISSET(FTS_NOCHDIR) &&
               (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
                 SET(FTS_NOCHDIR);                  SET(FTS_NOCHDIR);
   
         if (nitems == 0)          if (nitems == 0)
Line 489  fts_build(FTS *sp)
Line 491  fts_build(FTS *sp)
                 if (ISDOT(dp->d_name))                  if (ISDOT(dp->d_name))
                         continue;                          continue;
   
 #ifdef HAVE_DIRENT_NAMLEN  #if HAVE_DIRENT_NAMLEN
                 dlen = dp->d_namlen;                  dlen = dp->d_namlen;
 #else  #else
                 dlen = strlen(dp->d_name);                  dlen = strlen(dp->d_name);
Line 802  fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const c
Line 804  fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const c
         newfd = fd;          newfd = fd;
         if (ISSET(FTS_NOCHDIR))          if (ISSET(FTS_NOCHDIR))
                 return (0);                  return (0);
         if (fd < 0 && (newfd = open(path, O_RDONLY, 0)) < 0)          if (fd < 0 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0)
                 return (-1);                  return (-1);
         if (fstat(newfd, &sb)) {          if (fstat(newfd, &sb)) {
                 ret = -1;                  ret = -1;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

CVSweb