diff mbox series

[2/3] manual: clarify errno value on success [BZ #22615]

Message ID 20171221225453.13158-3-aurelien@aurel32.net
State New
Headers show
Series Fix wrong assumption about errno | expand

Commit Message

Aurelien Jarno Dec. 21, 2017, 10:54 p.m. UTC
The current glibc manual is ambiguous about the errno value on success
and suggests that it is left unchanged. Some functions might and
sometimes do change the errno value, however they never set it to 0.

This patch clarifies this section of the manual.

Changelog:
	[BZ #22615]
	* manual/errno.texi (Checking for Errors): Explicitly say that errno
	might be set on success.
---
 ChangeLog         |  6 ++++++
 manual/errno.texi | 12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

Comments

Carlos O'Donell Dec. 22, 2017, 3:10 a.m. UTC | #1
On 12/21/2017 02:54 PM, Aurelien Jarno wrote:
> The current glibc manual is ambiguous about the errno value on success
> and suggests that it is left unchanged. Some functions might and
> sometimes do change the errno value, however they never set it to 0.
> 
> This patch clarifies this section of the manual.
> 
> Changelog:
> 	[BZ #22615]
> 	* manual/errno.texi (Checking for Errors): Explicitly say that errno
> 	might be set on success.

OK.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  ChangeLog         |  6 ++++++
>  manual/errno.texi | 12 ++++++------
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index cb41a07a25..7bf30d27ef 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +2017-12-21  Aurelien Jarno  <aurelien@aurel32.net>
> +
> +	[BZ #22615]
> +	* manual/errno.texi (Checking for Errors): Explicitly say that errno
> +	might be set on success.
> +
>  2017-12-21  Aurelien Jarno  <aurelien@aurel32.net>
>  
>  	[BZ #22611]
> diff --git a/manual/errno.texi b/manual/errno.texi
> index 3e0b862c4e..eaac8e6dca 100644
> --- a/manual/errno.texi
> +++ b/manual/errno.texi
> @@ -50,12 +50,12 @@ possibility except when writing signal handlers.
>  The initial value of @code{errno} at program startup is zero.  Many
>  library functions are guaranteed to set it to certain nonzero values
>  when they encounter certain kinds of errors.  These error conditions are
> -listed for each function.  These functions do not change @code{errno}
> -when they succeed; thus, the value of @code{errno} after a successful
> -call is not necessarily zero, and you should not use @code{errno} to
> -determine @emph{whether} a call failed.  The proper way to do that is
> -documented for each function.  @emph{If} the call failed, you can
> -examine @code{errno}.
> +listed for each function.  These functions never set @code{errno} to zero
> +and might set it to a non-zero value when they succeed; thus, the value of
> +@code{errno} after a successful call is not necessarily zero, and you
> +should not use @code{errno} to determine @emph{whether} a call failed.
> +The proper way to do that is documented for each function.  @emph{If} the
> +call failed, you can examine @code{errno}.

OK.

>  
>  Many library functions can set @code{errno} to a nonzero value as a
>  result of calling other library functions which might fail.  You should
>
diff mbox series

Patch

diff --git a/ChangeLog b/ChangeLog
index cb41a07a25..7bf30d27ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2017-12-21  Aurelien Jarno  <aurelien@aurel32.net>
+
+	[BZ #22615]
+	* manual/errno.texi (Checking for Errors): Explicitly say that errno
+	might be set on success.
+
 2017-12-21  Aurelien Jarno  <aurelien@aurel32.net>
 
 	[BZ #22611]
diff --git a/manual/errno.texi b/manual/errno.texi
index 3e0b862c4e..eaac8e6dca 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -50,12 +50,12 @@  possibility except when writing signal handlers.
 The initial value of @code{errno} at program startup is zero.  Many
 library functions are guaranteed to set it to certain nonzero values
 when they encounter certain kinds of errors.  These error conditions are
-listed for each function.  These functions do not change @code{errno}
-when they succeed; thus, the value of @code{errno} after a successful
-call is not necessarily zero, and you should not use @code{errno} to
-determine @emph{whether} a call failed.  The proper way to do that is
-documented for each function.  @emph{If} the call failed, you can
-examine @code{errno}.
+listed for each function.  These functions never set @code{errno} to zero
+and might set it to a non-zero value when they succeed; thus, the value of
+@code{errno} after a successful call is not necessarily zero, and you
+should not use @code{errno} to determine @emph{whether} a call failed.
+The proper way to do that is documented for each function.  @emph{If} the
+call failed, you can examine @code{errno}.
 
 Many library functions can set @code{errno} to a nonzero value as a
 result of calling other library functions which might fail.  You should