From e231132fc308da33ca7310333141a88168ef881a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Oct 2022 14:54:53 +0100 Subject: [PATCH] gstdio: Document errno behaviour of g_clear_fd g_clear_fd has the same interaction with errno as g_close or most libc functions: on success it has an unspecified effect on errno, and on failure (other than programming error) it sets errno to indicate the reason for failure. Signed-off-by: Simon McVittie --- glib/gstdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/glib/gstdio.c b/glib/gstdio.c index c0d5e334d..673ed92a7 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -1845,6 +1845,10 @@ g_close (gint fd, * anything. * In both cases, set @fd_ptr to `-1` before returning. * + * Like g_close(), if closing the file descriptor fails, the error is + * stored in both %errno and @error. If this function succeeds, + * %errno is undefined. + * * It is a programming error for @fd_ptr to point to a non-negative * number that is not a valid file descriptor. *