diff options
Diffstat (limited to 'libc/stdio')
-rw-r--r-- | libc/stdio/getdelim.c | 6 | ||||
-rw-r--r-- | libc/stdio/popen.c | 2 | ||||
-rw-r--r-- | libc/stdio/remove.c | 2 | ||||
-rw-r--r-- | libc/stdio/stdio.c | 14 |
4 files changed, 12 insertions, 12 deletions
diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c index 6f9ebb4fb..9181f9aa0 100644 --- a/libc/stdio/getdelim.c +++ b/libc/stdio/getdelim.c @@ -43,14 +43,14 @@ ssize_t getdelim(char **linebuf, size_t *linebufsz, int delimiter, FILE *file) if ((file == NULL || linebuf==NULL || *linebuf == NULL || *linebufsz == 0) && !(*linebuf == NULL && *linebufsz ==0 )) { - errno=EINVAL; + __set_errno(EINVAL); return -1; } if (*linebuf == NULL && *linebufsz == 0){ *linebuf = malloc(GROWBY); if (!*linebuf) { - errno=ENOMEM; + __set_errno(ENOMEM); return -1; } *linebufsz += GROWBY; @@ -64,7 +64,7 @@ ssize_t getdelim(char **linebuf, size_t *linebufsz, int delimiter, FILE *file) while (idx > *linebufsz-2) { *linebuf = realloc(*linebuf, *linebufsz += GROWBY); if (!*linebuf) { - errno=ENOMEM; + __set_errno(ENOMEM); return -1; } } diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index bc91bb73b..0a91f0e22 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -21,7 +21,7 @@ FILE *popen (const char *command, const char *mode) reading = (mode[0] == 'r'); if ((!reading && (mode[0] != 'w')) || mode[1]) { - errno = EINVAL; /* Invalid mode arg. */ + __set_errno(EINVAL); /* Invalid mode arg. */ } else if (pipe(pipe_fd) == 0) { pr = pipe_fd[reading]; pnr = pipe_fd[1-reading]; diff --git a/libc/stdio/remove.c b/libc/stdio/remove.c index 115b871bb..af256e4aa 100644 --- a/libc/stdio/remove.c +++ b/libc/stdio/remove.c @@ -17,7 +17,7 @@ __const char *src; if (rv < 0 && errno == EISDIR) rv = rmdir(src); if (rv >= 0) - errno = er; + __set_errno(er); return rv; } diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index fe1c6a073..954318d39 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -279,7 +279,7 @@ int fflush(FILE *fp) * ANSI says behavior in this case is undefined but also says you * shouldn't flush a stream you were reading from. */ - errno = EBADF; /* Should we set stream error indicator? */ + __set_errno(EBADF); /* Should we set stream error indicator? */ rv = -1; } @@ -560,7 +560,7 @@ int fseek(FILE *fp, long int offset, int ref) #endif if ((ref < 0) || (ref > 2)) { - errno = EINVAL; + __set_errno(EINVAL); return -1; } @@ -610,7 +610,7 @@ FILE *fp; --pos; } if (pos < 0) { /* ungetcs at start of file? */ - errno = EIO; + __set_errno(EIO); pos = -1; } } @@ -666,7 +666,7 @@ const char *mode; open_mode = (O_WRONLY | O_CREAT | O_APPEND); break; default: /* illegal mode */ - errno = EINVAL; + __set_errno(EINVAL); goto _fopen_ERROR; } @@ -709,7 +709,7 @@ const char *mode; fd = -1; } else if (!(cur_mode & O_RDWR) && ((cur_mode ^ open_mode) & O_ACCMODE)) { - errno = EINVAL; + __set_errno(EINVAL); fd = -1; } } @@ -1037,7 +1037,7 @@ int fgetpos(FILE *fp, fpos_t *pos) fpos_t p; if (!pos) { /* NULL pointer. */ - errno = EINVAL; + __set_errno(EINVAL); return -1; } @@ -1056,7 +1056,7 @@ int fsetpos(FILE *fp, __const fpos_t *pos) if (pos) { /* Pointer ok. */ return fseek(fp, *pos, SEEK_SET); } - errno = EINVAL; /* NULL pointer. */ + __set_errno(EINVAL); /* NULL pointer. */ return EOF; } #endif |