diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-06 20:28:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-06 20:28:45 +0000 |
commit | 6278781655261a5011376b2fa2600996e32ca889 (patch) | |
tree | 11783e71b36c8c546c4dc02dff355b0f2478978b /libc/misc/dirent | |
parent | a704ccaa5232184844cd67315951b39f85a6ba04 (diff) |
Fix include/errno.h to not use kernel header, and instead use bits/errno.h.
This required we use _LIBC instead of __LIBC__ to be consistent with glibc.
This had some sideffects in sys/syscalls.h. While fixing things, I made
everything use __set_errno() for (eventual) thread support.
-Erik
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r-- | libc/misc/dirent/closedir.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/dirfd.c | 2 | ||||
-rw-r--r-- | libc/misc/dirent/opendir.c | 6 | ||||
-rw-r--r-- | libc/misc/dirent/readdir.c | 6 | ||||
-rw-r--r-- | libc/misc/dirent/rewinddir.c | 2 | ||||
-rw-r--r-- | libc/misc/dirent/seekdir.c | 2 | ||||
-rw-r--r-- | libc/misc/dirent/telldir.c | 4 |
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; } |