From patchwork Fri Dec 13 22:24:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Varoqui X-Patchwork-Id: 3342881 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EAB46C0D4A for ; Fri, 13 Dec 2013 22:27:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F292E207B0 for ; Fri, 13 Dec 2013 22:27:32 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id C9291205B7 for ; Fri, 13 Dec 2013 22:27:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBDMOKR7003535; Fri, 13 Dec 2013 17:24:20 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBDMOIul012754 for ; Fri, 13 Dec 2013 17:24:18 -0500 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBDMOIkJ023505 for ; Fri, 13 Dec 2013 17:24:18 -0500 Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com [209.85.213.178]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBDMOHPV000410 for ; Fri, 13 Dec 2013 17:24:17 -0500 Received: by mail-ig0-f178.google.com with SMTP id ut6so2057932igb.5 for ; Fri, 13 Dec 2013 14:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=Pk2tfHe/qPWRQC4nPQtxe0b7qQM0puejk4Nv8xtm0Sk=; b=IUt8iGwYO2dveXkX1zO21ezcIJCDuLDFeNGMMPsjBu0XmC2Tbst46MN14wNe6AMHtN K31xPOm9uabGvRvCAExzf4kGbQAHb0yk46/vRemJcFclsTRwwQfZY9oOVMDLVBhKw9bK xaVaIxhz8855x5Bx0VfOPYmOZsjVgY8im6WDc/YOSSv9wUo1g4VdAOGUYaPap3sW9qtM au1CAUyjgRAID4YRuSH3PZp9+R3lmVnZTl7HH8e0be/An1NuT+8NpvwFy/SNoRYXLcWj QcuArlTVeOlY9pk6r3RwFWBrg9vtUcHrEB6x3zZ+LT0z2YI9HM6ZW5a6A5J+0Qc1buff 0u6w== MIME-Version: 1.0 X-Received: by 10.42.24.138 with SMTP id w10mr3732672icb.22.1386973456897; Fri, 13 Dec 2013 14:24:16 -0800 (PST) Received: by 10.64.228.243 with HTTP; Fri, 13 Dec 2013 14:24:16 -0800 (PST) In-Reply-To: <1386936854-8399-2-git-send-email-hare@suse.de> References: <1386936854-8399-1-git-send-email-hare@suse.de> <1386936854-8399-2-git-send-email-hare@suse.de> Date: Fri, 13 Dec 2013 23:24:16 +0100 X-Google-Sender-Auth: Nirm6VfZch5NMrdZX7n7G-j49ms Message-ID: From: Christophe Varoqui To: device-mapper development X-RedHat-Spam-Score: -2.598 (BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, SPF_PASS, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Subject: Re: [dm-devel] [PATCH 01/11] Remove trailing spaces from sysfs attributes X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, HTML_MESSAGE,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hannes, FYI, related to this patch, commit 3e7763345a31e81318b70d7af68902984312f624 Author: Christophe Varoqui Date: Fri Dec 13 23:10:27 2013 +0100 [libmultipath] Fix a compilation warning Now that we chop the sysfs attribute strings, the size returned by strlcpy is not used anymore. Remove the variable to tame the compiler warning. \ @@ -163,7 +162,7 @@ sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len) \ devname, #fname); \ return -EINVAL; \ } \ - ret = strlcpy(buff, attr, len); \ + strlcpy(buff, attr, len); \ return strchop(buff); \ } Best regards, Christophe Varoqui On Fri, Dec 13, 2013 at 1:14 PM, Hannes Reinecke wrote: > Some sysfs attributes may contain trailing spaces, which only > serve to confuse matters. So strip them before continuing. > > Signed-off-by: Hannes Reinecke > --- > libmultipath/discovery.c | 2 +- > libmultipath/util.c | 3 ++- > libmultipath/util.h | 2 +- > 3 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c > index d5557d9..d519c02 100644 > --- a/libmultipath/discovery.c > +++ b/libmultipath/discovery.c > @@ -164,7 +164,7 @@ sysfs_get_##fname (struct udev_device * udev, char * > buff, size_t len) \ > return -EINVAL; \ > } \ > ret = strlcpy(buff, attr, len); \ > - return ret; \ > + return strchop(buff); \ > } > > declare_sysfs_get_str(devtype); > diff --git a/libmultipath/util.c b/libmultipath/util.c > index a9f5939..e6fd11d 100644 > --- a/libmultipath/util.c > +++ b/libmultipath/util.c > @@ -10,13 +10,14 @@ > #include "vector.h" > #include "structs.h" > > -void > +size_t > strchop(char *str) > { > int i; > > for (i=strlen(str)-1; i >=0 && isspace(str[i]); --i) ; > str[++i] = '\0'; > + return strlen(str); > } > > int > diff --git a/libmultipath/util.h b/libmultipath/util.h > index 44184a1..7b67dff 100644 > --- a/libmultipath/util.h > +++ b/libmultipath/util.h > @@ -1,7 +1,7 @@ > #ifndef _UTIL_H > #define _UTIL_H > > -void strchop(char *); > +size_t strchop(char *); > int basenamecpy (const char * src, char * dst, int); > int filepresent (char * run); > int get_word (char * sentence, char ** word); > -- > 1.8.1.4 > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel > --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index ccd3b62..b7470f8 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -143,7 +143,6 @@ path_discovery (vector pathvec, struct config * conf, int flag) extern ssize_t \ sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len) \ { \ - ssize_t ret; \ const char * attr; \ const char * devname; \