From patchwork Tue Jun 13 10:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dridi Boukelmoune X-Patchwork-Id: 1794386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=f5gEc1+v; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QgPRJ3PbHz20QH for ; Tue, 13 Jun 2023 20:09:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7956F3858288 for ; Tue, 13 Jun 2023 10:09:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7956F3858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686650954; bh=Kz6GpCivY8maByu6f4Hi0OPpQigOGwmxeelPAXjwvlw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=f5gEc1+v3hF99ZMA8RtSCD5ijpaw4CUism2J1Z/H1tCVkzlgF6dYUyu5v2qVS3dUK xSL9B0YwVklAyY4uwmchEfuBFfIeLJcMiGps3kVb9KbYVBwB8+O7j+GgCNoLPLcQDP EYtiqiVhx4K+hu3RHu+5n3Ao43ZdNCWWDwJI6V44= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id C1E403858284 for ; Tue, 13 Jun 2023 10:08:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1E403858284 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f642a24568so6480132e87.2 for ; Tue, 13 Jun 2023 03:08:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686650937; x=1689242937; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Kz6GpCivY8maByu6f4Hi0OPpQigOGwmxeelPAXjwvlw=; b=CIrSK3mthMiB8wbe8MHkGgBf7lYtSdxUmB8v+iDEV5shgVFMKZ5IzWAw9QbA/fwQ8f vHNg5PAStJYpXSlJ21/X1DH6E/CYoiTFZ1q5UU1WtYeYxHOwKLZhEdl74F2Y/o7EdKrF ZqifqkukVb0s3Yw6NgD1CrYoSiSiaW958QkSGaT0+j5jWGg1QWrkNuZf9HH8j3tcVhqz ijAbmHTit4S7xGcCz4/ocpjjmhNZ53SYy7kve8KZclDJJ4j3ETPRaqxSvStZa7dhmx+m B0TIdXc+TgBfEqCtoyri1OCWsQl/X/8rNYd0WeqZHBaN5pm0Qu1pmopEE1fUhwneemLb LZNA== X-Gm-Message-State: AC+VfDwmT5jMY/JEEvGhIVyjZcKBgY05cM9XPg8LTiTKDm4AxMsqhGqu +LhcH/9S2kDIxsfdbOr43asPn8Vf5Hs= X-Google-Smtp-Source: ACHHUZ4yEAH+3SX353NTGrCdqcuoHb9y4+KwBrKbo4kiEHWUgLA0XPRcmIVf3reikAblgfP0AcXWoQ== X-Received: by 2002:a19:4f42:0:b0:4f6:1b9e:d2e9 with SMTP id a2-20020a194f42000000b004f61b9ed2e9mr6361679lfk.33.1686650936963; Tue, 13 Jun 2023 03:08:56 -0700 (PDT) Received: from 3uFjGV4mFr2mP6Bw.. ([79.143.250.144]) by smtp.gmail.com with ESMTPSA id i10-20020a05600c290a00b003f819dfa0ddsm6730620wmd.28.2023.06.13.03.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 03:08:56 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Dridi Boukelmoune Subject: [PATCH v2 1/2] posix: Handle success in gai_strerror() Date: Tue, 13 Jun 2023 12:08:27 +0200 Message-Id: <20230613100828.47611-1-dridi.boukelmoune@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dridi Boukelmoune via Libc-alpha From: Dridi Boukelmoune Reply-To: Dridi Boukelmoune Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Dridi Boukelmoune --- sysdeps/posix/gai_strerror-strs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sysdeps/posix/gai_strerror-strs.h b/sysdeps/posix/gai_strerror-strs.h index 667c4b2d4a..cb497ff5ea 100644 --- a/sysdeps/posix/gai_strerror-strs.h +++ b/sysdeps/posix/gai_strerror-strs.h @@ -1,3 +1,4 @@ +_S(0, N_("Success")) _S(EAI_ADDRFAMILY, N_("Address family for hostname not supported")) _S(EAI_AGAIN, N_("Temporary failure in name resolution")) _S(EAI_BADFLAGS, N_("Bad value for ai_flags")) From patchwork Tue Jun 13 10:08:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dridi Boukelmoune X-Patchwork-Id: 1794387 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=edEJ8Wsv; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QgPRS5TpYz20QH for ; Tue, 13 Jun 2023 20:09:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B661A385701D for ; Tue, 13 Jun 2023 10:09:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B661A385701D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686650962; bh=Tl8XhT9K0NCH7CY/qj+Vg9i7q1z1NHBVR1YgJk0v5Io=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=edEJ8WsvvfSA0G5gKC8OfoZ97xsiyBHiBo18owZqd73CilKjPwqJc86igM3a86QP+ qdC+ugLqRGZ69XZYJQ+jDFFyoC3oAcyc7NZkOZiLUcUekZkRGfSwYA62q2f9t6fIQl pZjWXs/XkfxFfthB2h9tMZsmWRXLMDAiTvyQe3rc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 5AD153858020 for ; Tue, 13 Jun 2023 10:09:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AD153858020 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f62b552751so6409576e87.3 for ; Tue, 13 Jun 2023 03:09:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686650944; x=1689242944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tl8XhT9K0NCH7CY/qj+Vg9i7q1z1NHBVR1YgJk0v5Io=; b=K/qFvMsn2rrsPbOq1sXOKr1rvcGQdl+CIPxkEeUc1bSp9qYiaBddfAifiN9Fh8hjus FkXiLQFSil8e5nCJt3iU8VUwf5v1sXVgmgVCO0wpvofn+tdcm0h263FE11EZDnQAG2QJ PfAX0EHYL1Ucd1zNObhhR+AX5mhps4vLF1cYaZwFbeKvJnXeWS8HLaVXGsNBrQYSWuXD eQr8prJgpSb5Za42NTNFjkIyNeV2KO0BV+6cDI98CDL15GnECgqlxlQ8TmILbTRSG1YS s1FraapGG81W5pjCYFbJLCnDltsM0yeVU7ZaDMl65QvkbTR534p++0gmzZBmoKzpRLDQ /qeQ== X-Gm-Message-State: AC+VfDzMNYZut0hnaWM7glcUbKusLMjfbDgpuJKihbnHWWR3E+UWhfE+ mybwQ7OvwyCgzuYeFiwelni0qeSB6qk= X-Google-Smtp-Source: ACHHUZ58YQJTtwMjKz+NvCxsBjd4oMkuUxdXiFz5v0No4mUouX4YRZyCwSmWbgCsrSHD/mdvuk6q6w== X-Received: by 2002:a19:ca0a:0:b0:4f4:d45d:1616 with SMTP id a10-20020a19ca0a000000b004f4d45d1616mr4809840lfg.67.1686650943725; Tue, 13 Jun 2023 03:09:03 -0700 (PDT) Received: from 3uFjGV4mFr2mP6Bw.. ([79.143.250.144]) by smtp.gmail.com with ESMTPSA id i10-20020a05600c290a00b003f819dfa0ddsm6730620wmd.28.2023.06.13.03.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 03:09:03 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Dridi Boukelmoune Subject: [PATCH v2 2/2] posix: Add test case for gai_strerror() Date: Tue, 13 Jun 2023 12:08:28 +0200 Message-Id: <20230613100828.47611-2-dridi.boukelmoune@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230613100828.47611-1-dridi.boukelmoune@gmail.com> References: <20230613100828.47611-1-dridi.boukelmoune@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dridi Boukelmoune via Libc-alpha From: Dridi Boukelmoune Reply-To: Dridi Boukelmoune Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Dridi Boukelmoune Reviewed-by: Arjun Shankar --- posix/Makefile | 1 + posix/tst-gai_strerror.c | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 posix/tst-gai_strerror.c diff --git a/posix/Makefile b/posix/Makefile index e19b74cd67..ad43cbdec6 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -275,6 +275,7 @@ tests := \ tst-fnmatch6 \ tst-fnmatch7 \ tst-fork \ + tst-gai_strerror \ tst-getaddrinfo \ tst-getaddrinfo2 \ tst-getaddrinfo3 \ diff --git a/posix/tst-gai_strerror.c b/posix/tst-gai_strerror.c new file mode 100644 index 0000000000..7d886df2a4 --- /dev/null +++ b/posix/tst-gai_strerror.c @@ -0,0 +1,43 @@ +/* Test for gai_strerror() + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include + +#include +#include + +static int +do_test (void) +{ + unsetenv ("LANGUAGE"); + + xsetlocale (LC_ALL, "C"); + + TEST_COMPARE_STRING (gai_strerror (1), "Unknown error"); + TEST_COMPARE_STRING (gai_strerror (0), "Success"); + TEST_COMPARE_STRING (gai_strerror (EAI_OVERFLOW), + "Result too large for supplied buffer"); + + return 0; +} + +#include