author | Olivier Brunel
<jjk@jjacky.com> 2023-04-02 07:00:28 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-05-20 18:06:34 UTC |
parent | a7090361405dc8633f924c8126aab33684403bea |
src/liblimb/obuffers.h/obuffers_adddbg.c | +7 | -2 |
src/liblimb/obuffers.h/obuffers_addlog.c | +7 | -2 |
diff --git a/src/liblimb/obuffers.h/obuffers_adddbg.c b/src/liblimb/obuffers.h/obuffers_adddbg.c index 6d2a65f..13f4d36 100644 --- a/src/liblimb/obuffers.h/obuffers_adddbg.c +++ b/src/liblimb/obuffers.h/obuffers_adddbg.c @@ -12,7 +12,12 @@ obuffers_adddbg(int fd) { if (buffer_dbg_.fd >= 0) return (errno = EADDRINUSE, 0); - if (!buffer_init(&buffer_dbg_, &fd_writev, fd, buf, sizeof(buf))) + + buffer_init(&buffer_dbg_, &fd_writev, fd, buf, sizeof(buf)); + if (!obuffers_addextra(&buffer_dbg_, OLVL_DEBUG)) { + buffer_dbg_.fd = -1; return 0; - return obuffers_addextra(&buffer_dbg_, OLVL_DEBUG); + } + + return 1; } diff --git a/src/liblimb/obuffers.h/obuffers_addlog.c b/src/liblimb/obuffers.h/obuffers_addlog.c index 9e556dc..97a2d7a 100644 --- a/src/liblimb/obuffers.h/obuffers_addlog.c +++ b/src/liblimb/obuffers.h/obuffers_addlog.c @@ -12,7 +12,12 @@ obuffers_addlog(int fd) { if (buffer_log_.fd >= 0) return (errno = EADDRINUSE, 0); - if (!buffer_init(&buffer_log_, &fd_writev, fd, buf, sizeof(buf))) + + buffer_init(&buffer_log_, &fd_writev, fd, buf, sizeof(buf)); + if (!obuffers_addextra(&buffer_log_, OLVL_NORMAL)) { + buffer_log_.fd = -1; return 0; - return obuffers_addextra(&buffer_log_, OLVL_NORMAL); + } + + return 1; }