All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Varoqui <christophe.varoqui@opensvc.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: [PATCH 01/11] Remove trailing spaces from sysfs attributes
Date: Fri, 13 Dec 2013 23:24:16 +0100	[thread overview]
Message-ID: <CABr-GnfWgvX-oxS1F4N6ktOkRR91j-zKbaSt7JSRe5WwO-eXbg@mail.gmail.com> (raw)
In-Reply-To: <1386936854-8399-2-git-send-email-hare@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 3763 bytes --]

Hannes,

FYI, related to this patch,

commit 3e7763345a31e81318b70d7af68902984312f624
Author: Christophe Varoqui <christophe.varoqui@opensvc.com>
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.

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;                                           \
                                                                        \
@@ -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 <hare@suse.de> wrote:

> Some sysfs attributes may contain trailing spaces, which only
> serve to confuse matters. So strip them before continuing.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  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
>

[-- Attachment #1.2: Type: text/html, Size: 4964 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2013-12-13 22:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
2013-12-13 12:14 ` [PATCH 01/11] Remove trailing spaces from sysfs attributes Hannes Reinecke
2013-12-13 22:24   ` Christophe Varoqui [this message]
2013-12-13 12:14 ` [PATCH 02/11] Document 'wwids_file' and 'reservation_key' Hannes Reinecke
2013-12-13 12:14 ` [PATCH 03/11] libmultipath: Fix typo in retain_attached_hw_handler Hannes Reinecke
2013-12-13 12:14 ` [PATCH 04/11] multipath: do not print 'path is up' for removed paths Hannes Reinecke
2013-12-13 12:14 ` [PATCH 05/11] libmultipath: proactively remove path Hannes Reinecke
2013-12-13 12:14 ` [PATCH 06/11] multipath: do not call tur in sync mode if pthread_cancel fails Hannes Reinecke
2013-12-13 12:14 ` [PATCH 07/11] multipathd: Update manpage Hannes Reinecke
2013-12-13 12:14 ` [PATCH 08/11] Reset timezone information on reconfigure Hannes Reinecke
2013-12-13 22:22   ` Christophe Varoqui
2013-12-13 12:14 ` [PATCH 09/11] multipathd: Correctly initialize udev context Hannes Reinecke
2013-12-13 12:14 ` [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state Hannes Reinecke
2013-12-13 22:02   ` Christophe Varoqui
2013-12-13 12:14 ` [PATCH 11/11] Make 'multipath -t' able to run as normal user Hannes Reinecke
2013-12-13 12:17 ` [PATCH 00/11] SLES resync Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABr-GnfWgvX-oxS1F4N6ktOkRR91j-zKbaSt7JSRe5WwO-eXbg@mail.gmail.com \
    --to=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.