never close fd 0, 1 or 2 in buffer_close

master
leitner 11 years ago
parent 85d14a2703
commit 53e2af7389

@ -2,6 +2,6 @@
#include <unistd.h>
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);
}

@ -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;
}

@ -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;
}

@ -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);

Loading…
Cancel
Save