ref: d229b8ba4abe771ef305a1a9c1c647ac67e9e8bd
parent: ee7d78d5b4c39eabf0f2bdefae4a173a421ec8a3
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Nov 6 21:25:47 EST 2024
ios: file descriptors are int, not long
--- a/ios.c
+++ b/ios.c
@@ -74,12 +74,12 @@
}
static int
-_os_write(long fd, const void *buf, size_t n, size_t *nwritten)
+_os_write(int fd, const void *buf, size_t n, size_t *nwritten)
{
ssize_t r;
while(1){
- r = write((int)fd, buf, n);
+ r = write(fd, buf, n);
if(r > -1){
*nwritten = (size_t)r;
break;
@@ -98,7 +98,7 @@
}
static int
-_os_write_all(long fd, const uint8_t *buf, size_t n, size_t *nwritten)
+_os_write_all(int fd, const uint8_t *buf, size_t n, size_t *nwritten)
{
size_t wrote;
@@ -768,7 +768,7 @@
}
ios_t *
-ios_fd(ios_t *s, long fd, int isfile, int own)
+ios_fd(ios_t *s, int fd, int isfile, int own)
{
_ios_init(s);
s->fd = fd;
--- a/ios.h
+++ b/ios.h
@@ -88,7 +88,7 @@
ios_t *ios_mem(ios_t *s, size_t initsize);
ios_t *ios_str(ios_t *s, char *str);
ios_t *ios_static_buffer(ios_t *s, const uint8_t *buf, size_t sz);
-ios_t *ios_fd(ios_t *s, long fd, int isfile, int own);
+ios_t *ios_fd(ios_t *s, int fd, int isfile, int own);
// todo: ios_socket
extern ios_t *ios_stdin;
extern ios_t *ios_stdout;