Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: fusl/src/dirent/readdir_r.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/dirent/readdir.c ('k') | fusl/src/dirent/rewinddir.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <dirent.h>
2 #include <errno.h>
3 #include <string.h>
4 #include "__dirent.h"
5 #include "libc.h"
6
7 int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **re strict result)
8 {
9 struct dirent *de;
10 int errno_save = errno;
11 int ret;
12
13 LOCK(dir->lock);
14 errno = 0;
15 de = readdir(dir);
16 if ((ret = errno)) {
17 UNLOCK(dir->lock);
18 return ret;
19 }
20 errno = errno_save;
21 if (de) memcpy(buf, de, de->d_reclen);
22 else buf = NULL;
23
24 UNLOCK(dir->lock);
25 *result = buf;
26 return 0;
27 }
28
29 LFS64_2(readdir_r, readdir64_r);
OLDNEW
« no previous file with comments | « fusl/src/dirent/readdir.c ('k') | fusl/src/dirent/rewinddir.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698