blob: 6f2c5d81c7153299d6180a6340681d32d6015818 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/* ISC license. */
#include <skalibs/iobuffer.h>
int iobuffer_salvage (iobuffer *b)
{
iobufferu u ;
if (!b->isk) return 1 ;
if (!iobufferu_init(&u, b->x.k.fd[0], b->x.k.fd[1])) return 0 ;
if (!iobuffer_ufromk(&u, &b->x.k)) goto err ;
iobufferk_finish(&b->x.k) ;
b->x.u = u ;
b->isk = 0 ;
return 1 ;
err:
iobufferu_finish(&u) ;
return 0 ;
}
|