author | Olivier Brunel
<jjk@jjacky.com> 2023-04-02 06:54:02 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-05-20 18:06:34 UTC |
parent | 915439d4e0fc4e2a0afd3e8cc1f17086f93c333b |
src/doc/obuffers.h/obuffers_addlog.3.md | +6 | -2 |
src/liblimb/obuffers.h/obuffers_remdbg.c | +3 | -2 |
src/liblimb/obuffers.h/obuffers_remlog.c | +3 | -2 |
diff --git a/src/doc/obuffers.h/obuffers_addlog.3.md b/src/doc/obuffers.h/obuffers_addlog.3.md index 94475d9..189b472 100644 --- a/src/doc/obuffers.h/obuffers_addlog.3.md +++ b/src/doc/obuffers.h/obuffers_addlog.3.md @@ -35,8 +35,12 @@ using `obuffers_adddbg`(). # RETURN VALUE -These functions returns 1 on success. Otherwise they returns 0 and sets `errno` -to indicate the error. +The `obuffers_addlog`() and `obuffers_adddbg`() functions return 1 on success. +Otherwise they returns 0 and sets `errno` to indicate the error. + +The `obuffers_remlog`() and `obuffers_remdbg`() functions return the file +descriptor that was used in the buffer on success. Otherwise, they return -1 and +set `errno` to indicate the error. # ERRORS diff --git a/src/liblimb/obuffers.h/obuffers_remdbg.c b/src/liblimb/obuffers.h/obuffers_remdbg.c index 269a9d1..3e7cdb4 100644 --- a/src/liblimb/obuffers.h/obuffers_remdbg.c +++ b/src/liblimb/obuffers.h/obuffers_remdbg.c @@ -8,8 +8,9 @@ extern buffer buffer_dbg_; int obuffers_remdbg(void) { + int fd = buffer_dbg_.fd; if (!obuffers_remextra(&buffer_dbg_)) - return 0; + return -1; buffer_dbg_.fd = -1; - return 0; + return fd; } diff --git a/src/liblimb/obuffers.h/obuffers_remlog.c b/src/liblimb/obuffers.h/obuffers_remlog.c index 4c0cf2a..32331d7 100644 --- a/src/liblimb/obuffers.h/obuffers_remlog.c +++ b/src/liblimb/obuffers.h/obuffers_remlog.c @@ -8,8 +8,9 @@ extern buffer buffer_log_; int obuffers_remlog(void) { + int fd = buffer_log_.fd; if (!obuffers_remextra(&buffer_log_)) - return 0; + return -1; buffer_log_.fd = -1; - return 0; + return fd; }