| Line | Source | Count | 
| 1 |  | - | 
| 2 |  | - | 
| 3 |  | - | 
| 4 |  | - | 
| 5 |  | - | 
| 6 |  | - | 
| 7 |  | - | 
| 8 |  | - | 
| 9 |  | - | 
| 10 |  | - | 
| 11 |  | - | 
| 12 |  | - | 
| 13 | void | - | 
| 14 | closefrom(int lowfd) | - | 
| 15 | { | - | 
| 16 |     long fd, maxfd; | - | 
| 17 |  | - | 
| 18 |     char fdpath[ | - | 
| 19 |                4096 | - | 
| 20 |                        ], *endp; | - | 
| 21 |     struct dirent *dent; | - | 
| 22 |     DIR *dirp; | - | 
| 23 |     int len; | - | 
| 24 |  | - | 
| 25 |  | - | 
| 26 |     len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid()); | - | 
| 27 |     if (len > 0| TRUE | evaluated 2 times by 1 test |  | FALSE | never evaluated |  
   && (| TRUE | evaluated 2 times by 1 test |  | FALSE | never evaluated |  
  size_t)len < sizeof(fdpath)| TRUE | evaluated 2 times by 1 test |  | FALSE | never evaluated |  
   && (| TRUE | evaluated 2 times by 1 test |  | FALSE | never evaluated |  
  dirp = opendir(fdpath))| TRUE | evaluated 2 times by 1 test |  | FALSE | never evaluated |  
  ) { | 0-2 | 
| 28 |  while ((| TRUE | evaluated 12 times by 1 test |  | FALSE | evaluated 2 times by 1 test |  
  dent = readdir(dirp)) != | TRUE | evaluated 12 times by 1 test |  | FALSE | evaluated 2 times by 1 test |  
  | 2-12 | 
| 29 |                                  ((void *)0)| TRUE | evaluated 12 times by 1 test |  | FALSE | evaluated 2 times by 1 test |  
  | 2-12 | 
| 30 |                                      ) { | - | 
| 31 |      fd = strtol(dent->d_name, &endp, 10); | - | 
| 32 |      if (dent->d_name != endp| TRUE | evaluated 8 times by 1 test |  | FALSE | evaluated 4 times by 1 test |  
   && *| TRUE | evaluated 8 times by 1 test |  | FALSE | never evaluated |  
  endp == '\0'| TRUE | evaluated 8 times by 1 test |  | FALSE | never evaluated |  
   && | 0-8 | 
| 33 |   fd >= 0| TRUE | evaluated 8 times by 1 test |  | FALSE | never evaluated |  
   && fd < 0x7fffffff| TRUE | evaluated 8 times by 1 test |  | FALSE | never evaluated |  
   && fd >= lowfd| TRUE | evaluated 2 times by 1 test |  | FALSE | evaluated 6 times by 1 test |  
   && fd != dirfd(dirp)| TRUE | never evaluated |  | FALSE | evaluated 2 times by 1 test |  
  ) | 0-8 | 
| 34 |   ( never executed: (void) close((int) fd); void) close((int) fd);never executed: (void) close((int) fd);  | 0 | 
| 35 |  }executed 12 times by 1 test:  end of block  | 12 | 
| 36 |  (void) closedir(dirp); | - | 
| 37 |     }executed 2 times by 1 test:  end of block  else | 2 | 
| 38 |  | - | 
| 39 |     { | - | 
| 40 |  | - | 
| 41 |  | - | 
| 42 |  | - | 
| 43 |  | - | 
| 44 |  | - | 
| 45 |  | - | 
| 46 |  maxfd = sysconf( | - | 
| 47 |                 _SC_OPEN_MAX | - | 
| 48 |                             ); | - | 
| 49 |  | - | 
| 50 |  | - | 
| 51 |  | - | 
| 52 |  if (maxfd < 0| TRUE | never evaluated |  | FALSE | never evaluated |  
  ) | 0 | 
| 53 |      maxfd = 256; never executed: maxfd = 256;  | 0 | 
| 54 |  | - | 
| 55 |  for (fd = lowfd; fd < maxfd| TRUE | never evaluated |  | FALSE | never evaluated |  
  ; fd++) | 0 | 
| 56 |      ( never executed: (void) close((int) fd); void) close((int) fd);never executed: (void) close((int) fd);  | 0 | 
| 57 |     } never executed: end of block  | 0 | 
| 58 | } | - | 
 |  |  |