1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../dietlibc/fdopendir.patch
5 # Copyright (C) 2011 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 Of course for udev, too, what else, ...
19 - Rene Rebe <rene@exactcode.de>
21 --- dietlibc/include/dirent.h.vanilla 2011-01-06 12:29:39.000000000 +0100
22 +++ dietlibc/include/dirent.h 2011-01-06 12:30:04.000000000 +0100
24 typedef struct __dirstream DIR;
26 DIR *opendir (const char *__name) __THROW;
27 +DIR *fdopendir(int fd) __THROW;
28 int closedir (DIR *__dirp) __THROW;
29 struct dirent *readdir (DIR *__dirp) __THROW;
30 struct dirent64 *readdir64 (DIR *__dirp) __THROW;
31 --- dietlibc/lib/fdopendir.c.vanilla 2011-01-06 12:30:22.000000000 +0100
32 +++ dietlibc/lib/fdopendir.c 2011-01-06 12:33:58.000000000 +0100
34 +#include "dietdirent.h"
35 +#include <sys/mman.h>
41 +DIR* fdopendir (int fd) {
43 + int flags = fcntl (fd, F_GETFL);
44 + if (flags == -1 || (flags & O_DIRECTORY) == 0)
45 + goto lose; /* TODO: set errno = ENOTDIR; */
48 + if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
50 + t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
51 + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
52 + if (t == MAP_FAILED)