File:  [DVB] / dietlibc / lib / fdopendir.c
Revision 1.2: download - view: text, annotated - select for diffs
Fri May 24 23:36:59 2013 UTC (11 years ago) by leitner
Branches: MAIN
CVS tags: HEAD
if mmap fails, don't close fd

#include "dietdirent.h"
#include <sys/mman.h>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
#include <fcntl.h>

DIR*  fdopendir ( int fd ) {
  DIR*  t  = NULL;

  if ( fd >= 0 ) {
    t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, 
		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
    if (t != MAP_FAILED)
      t->fd = fd;
  }


  return t;
}

LinuxTV legacy CVS <linuxtv.org/cvs>