never close fd 0, 1 or 2 in buffer_close
This commit is contained in:
parent
85d14a2703
commit
53e2af7389
@ -2,6 +2,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
void buffer_close(buffer* b) {
|
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);
|
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->a=l;
|
||||||
b->fd=0;
|
b->fd=0;
|
||||||
b->op=dummyreadwrite;
|
b->op=dummyreadwrite;
|
||||||
|
b->deinit=0;
|
||||||
}
|
}
|
||||||
|
@ -22,5 +22,6 @@ int buffer_tosa(buffer* b,stralloc* sa) {
|
|||||||
b->fd=0;
|
b->fd=0;
|
||||||
b->op=strallocwrite;
|
b->op=strallocwrite;
|
||||||
b->cookie=sa;
|
b->cookie=sa;
|
||||||
|
b->deinit=0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ip4.h"
|
#include "ip4.h"
|
||||||
#include "ip6.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))
|
if (ip6_isv4mapped(ip))
|
||||||
return fmt_ip4(s,ip+12);
|
return fmt_ip4(s,ip+12);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user