diff --git a/buffer/buffer_close.c b/buffer/buffer_close.c index ebd8691..7a2276a 100644 --- a/buffer/buffer_close.c +++ b/buffer/buffer_close.c @@ -2,6 +2,6 @@ #include void buffer_close(buffer* b) { - if (b->fd != -1) close(b->fd); + if (b->fd > 2) close(b->fd); if (b->deinit) b->deinit(b); } diff --git a/buffer/buffer_frombuf.c b/buffer/buffer_frombuf.c index 0d22e50..0c9d931 100644 --- a/buffer/buffer_frombuf.c +++ b/buffer/buffer_frombuf.c @@ -15,4 +15,5 @@ void buffer_frombuf(buffer* b,const char* x,size_t l) { b->a=l; b->fd=0; b->op=dummyreadwrite; + b->deinit=0; } diff --git a/buffer/buffer_tosa.c b/buffer/buffer_tosa.c index aa6f119..99812ea 100644 --- a/buffer/buffer_tosa.c +++ b/buffer/buffer_tosa.c @@ -22,5 +22,6 @@ int buffer_tosa(buffer* b,stralloc* sa) { b->fd=0; b->op=strallocwrite; b->cookie=sa; + b->deinit=0; return 0; } diff --git a/socket/fmt_ip6ifc.c b/socket/fmt_ip6ifc.c index 51f872d..3bd60b7 100644 --- a/socket/fmt_ip6ifc.c +++ b/socket/fmt_ip6ifc.c @@ -3,7 +3,7 @@ #include "ip4.h" #include "ip6.h" -unsigned int fmt_ip6ifc(char *s,const char ip[16],uint32 scope_id) +size_t fmt_ip6ifc(char *s,const char ip[16],uint32 scope_id) { if (ip6_isv4mapped(ip)) return fmt_ip4(s,ip+12);