Browse Source

never close fd 0, 1 or 2 in buffer_close

master
Felix von Leitner 7 years ago
parent
commit
e058337c40
  1. 2
      buffer/buffer_close.c
  2. 1
      buffer/buffer_frombuf.c
  3. 1
      buffer/buffer_tosa.c
  4. 2
      socket/fmt_ip6ifc.c

2
buffer/buffer_close.c

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

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

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

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

Loading…
Cancel
Save