From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 9AEEC1F461 for ; Fri, 19 Jul 2019 03:24:37 +0000 (UTC) Received: from localhost ([::1]:42134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoJVc-0000wh-I9 for normalperson@yhbt.net; Thu, 18 Jul 2019 23:24:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57357) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoJVa-0000wX-2j for bug-gnulib@gnu.org; Thu, 18 Jul 2019 23:24:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoJVZ-00055Q-12 for bug-gnulib@gnu.org; Thu, 18 Jul 2019 23:24:34 -0400 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::3]:36721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hoJVY-00053r-BG for bug-gnulib@gnu.org; Thu, 18 Jul 2019 23:24:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1563506669; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=vQKd7SPZDn2NprnsCdUzYOQuUu4XO1X4ifwUAU4Yuhs=; b=C1KUUMIptejk8sSqA32xhwEgJCGPxj0XxKxEga0YYtrNzWbsxGrsvns45PmHtcOgtw 2Ft5e6/9wZ272Gb9lFDzPC1RolSlu+0OjWRjvF+D919U+2hc5wjFJN+u4F8zw3aHEaup r7mFgWY6aHGFRrFnnS5evzQjazWjfL8DtDhY/lAdw10QhrdYzriP5btyS/1cvayH0rQx /FbOPDVDt6HKWQnAyEjl7a0iU9WC52PIHj8HT6ltS4jPSGSP/oEfY0+0d4Uj5G4NZDp5 /XPe3A0oawl1iPkdFunqYnr4DdwOLoX3tfdtVEGWJMPBjN0SUB3Owgn38ZkMhFZhHRGl E1lQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGaf0zJZW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id v018bcv6J3OErjd (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Fri, 19 Jul 2019 05:24:14 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: [PATCH] areadlink-with-size: guess a buffer size with 0 size Date: Fri, 19 Jul 2019 05:24:12 +0200 Message-ID: <4487298.rakl1ii0gV@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-154-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <92271515-1daf-eb47-fa3b-65acbcd59de1@cs.ucla.edu> References: <7AC7AA2A-EDEA-4A80-9A5A-02FAA2D823EF@whamcloud.com> <360612c8-356b-f139-507f-2282c68fae3f@draigBrady.com> <92271515-1daf-eb47-fa3b-65acbcd59de1@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5301::3 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Dilger , Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Paul Eggert wrote on 2019-07-06: > The string length determination can easily be > avoided, so I installed the attached which does that. This patch produces GCC warnings about the use of memcpy(). And mine as well, about the use of strlen(). This patch fixes it: 2019-07-19 Bruno Haible areadlink-with-size, xgethostname, xgetdomainname: Fix GCC warning. * lib/areadlink-with-size.c: Include . * lib/areadlinkat-with-size.c: Likewise. * lib/xgethostname.c: Likewise. * lib/xgetdomainname.c: Likewise. diff --git a/lib/areadlink-with-size.c b/lib/areadlink-with-size.c index ae3c782..95a28b3 100644 --- a/lib/areadlink-with-size.c +++ b/lib/areadlink-with-size.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #ifndef SSIZE_MAX diff --git a/lib/areadlinkat-with-size.c b/lib/areadlinkat-with-size.c index ed46d59..22d39a9 100644 --- a/lib/areadlinkat-with-size.c +++ b/lib/areadlinkat-with-size.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #if HAVE_READLINKAT diff --git a/lib/xgetdomainname.c b/lib/xgetdomainname.c index 65df990..a1accf6 100644 --- a/lib/xgetdomainname.c +++ b/lib/xgetdomainname.c @@ -28,6 +28,9 @@ /* Get errno. */ #include +/* Get strlen. */ +#include + /* Get free. */ #include diff --git a/lib/xgethostname.c b/lib/xgethostname.c index 4bcb00f..5b3154a 100644 --- a/lib/xgethostname.c +++ b/lib/xgethostname.c @@ -25,6 +25,7 @@ #include #include +#include #include #include "xalloc.h"