From patchwork Thu Dec 21 22:54:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 852163 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-88521-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="H44gBSfx"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z2n6j1mdXz9s7F for ; Fri, 22 Dec 2017 09:55:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=CnE9+Z3A3IAXZNifK2ajZkf/tU8w8NH Cv8UiqNJglNiwIJfsuz1HmBfhu3qjwY6LsrZlnMw/qlYelShA70UWxCK0E1kvQT2 vzSgDSId/rqytseSXJTkyAGzulbzogz/5l1uycCj5zwd80CLWG2D4YHpU+feitg6 1X6Ov38J2xpU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=liruIIXgALRcWUbNniK6aWcyFns=; b=H44gB SfxCrfxAFVxw0wd+B4AOtTHPMyjatKzZlNsHOqmZNm0RgeyRGrfMu6gSbWgHF23X +GIXdofnwUjZesp4z9GN4GnDR8ZD7tTMBuEyYIjcjTwrnLh7C2POtwKTKHM7vwsN Z9TZAAtD9NO9g7Fz7PabVl9XtSh2yrm880Kl7I= Received: (qmail 50407 invoked by alias); 21 Dec 2017 22:55:06 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 50197 invoked by uid 89); 21 Dec 2017 22:55:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH 2/3] manual: clarify errno value on success [BZ #22615] Date: Thu, 21 Dec 2017 23:54:52 +0100 Message-Id: <20171221225453.13158-3-aurelien@aurel32.net> In-Reply-To: <20171221225453.13158-1-aurelien@aurel32.net> References: <20171221225453.13158-1-aurelien@aurel32.net> 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. Reviewed-by: Carlos O'Donell --- 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 + + [BZ #22615] + * manual/errno.texi (Checking for Errors): Explicitly say that errno + might be set on success. + 2017-12-21 Aurelien Jarno [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