summaryrefslogtreecommitdiff
path: root/libc/misc/dirent
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r--libc/misc/dirent/closedir.c4
-rw-r--r--libc/misc/dirent/dirfd.c2
-rw-r--r--libc/misc/dirent/opendir.c6
-rw-r--r--libc/misc/dirent/readdir.c6
-rw-r--r--libc/misc/dirent/rewinddir.c2
-rw-r--r--libc/misc/dirent/seekdir.c2
-rw-r--r--libc/misc/dirent/telldir.c4
7 files changed, 13 insertions, 13 deletions
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c
index f2ead00f2..a2ac83b17 100644
--- a/libc/misc/dirent/closedir.c
+++ b/libc/misc/dirent/closedir.c
@@ -9,13 +9,13 @@ int closedir(DIR * dir)
int fd;
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
/* We need to check dd_fd. */
if (dir->dd_fd == -1) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
fd = dir->dd_fd;
diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c
index d401dccd2..d6c1e6647 100644
--- a/libc/misc/dirent/dirfd.c
+++ b/libc/misc/dirent/dirfd.c
@@ -4,7 +4,7 @@
int dirfd(DIR * dir)
{
if (!dir || dir->dd_fd == -1) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index 329515447..0ac1637b3 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -21,7 +21,7 @@ DIR *opendir(const char *name)
if (stat(name, &statbuf))
return NULL;
if (!S_ISDIR(statbuf.st_mode)) {
- errno = ENOTDIR;
+ __set_errno(ENOTDIR);
return NULL;
}
if ((fd = open(name, O_RDONLY)) < 0)
@@ -33,7 +33,7 @@ DIR *opendir(const char *name)
return NULL;
if (!(ptr = malloc(sizeof(*ptr)))) {
close(fd);
- errno = ENOMEM;
+ __set_errno(ENOMEM);
return NULL;
}
@@ -44,7 +44,7 @@ DIR *opendir(const char *name)
if (!(buf = malloc(ptr->dd_max))) {
close(fd);
free(ptr);
- errno = ENOMEM;
+ __set_errno(ENOMEM);
return NULL;
}
ptr->dd_fd = fd;
diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c
index a755ed24d..0bb03f4c2 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -14,7 +14,7 @@ struct dirent *readdir(DIR * dir)
struct dirent *de;
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return NULL;
}
@@ -37,7 +37,7 @@ struct dirent *readdir(DIR * dir)
dir->dd_getdents = no_getdents;
abort();
}
- errno = result;
+ __set_errno(result);
}
return NULL;
@@ -63,7 +63,7 @@ struct dirent *readdir(DIR * dir)
if (strlen((char *) &de->d_type) > 10)
de->d_name[10] = 0;
strcpy(dir->dd_buf->d_name, (char *) &de->d_name);
- errno = 0;
+ __set_errno(0);
return dir->dd_buf;
}
diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c
index 9d147fca2..2fff9101c 100644
--- a/libc/misc/dirent/rewinddir.c
+++ b/libc/misc/dirent/rewinddir.c
@@ -7,7 +7,7 @@
void rewinddir(DIR * dir)
{
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return;
}
lseek(dir->dd_fd, 0, SEEK_SET);
diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c
index 7e4f24f72..3ff9f5da9 100644
--- a/libc/misc/dirent/seekdir.c
+++ b/libc/misc/dirent/seekdir.c
@@ -6,7 +6,7 @@
void seekdir(DIR * dir, off_t offset)
{
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return;
}
dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
diff --git a/libc/misc/dirent/telldir.c b/libc/misc/dirent/telldir.c
index 33e163aba..872cddbf1 100644
--- a/libc/misc/dirent/telldir.c
+++ b/libc/misc/dirent/telldir.c
@@ -8,7 +8,7 @@ off_t telldir(DIR * dir)
off_t offset;
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
@@ -27,7 +27,7 @@ off_t telldir(DIR * dir)
break;
default:
- errno = EBADF;
+ __set_errno(EBADF);
offset = -1;
}