]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hardlink, wall: fix variable shadowing
authorSami Kerola <kerolasa@iki.fi>
Sat, 9 Feb 2019 08:47:43 +0000 (08:47 +0000)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Feb 2019 12:20:34 +0000 (13:20 +0100)
misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;

term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/hardlink.c
term-utils/wall.c

index 1558573f76f533019265dd89ed741332a5f10714..f7cfc961bbe02a5fc37ba9f659fb1e4c7828b518 100644 (file)
@@ -100,9 +100,9 @@ static inline unsigned int hash(off_t size, time_t mtime)
 }
 
 __attribute__ ((always_inline))
-static inline int stcmp(struct stat *st1, struct stat *st2, int content_only)
+static inline int stcmp(struct stat *st1, struct stat *st2, int content_scope)
 {
-       if (content_only)
+       if (content_scope)
                return st1->st_size != st2->st_size;
 
        return st1->st_mode != st2->st_mode
index 4c49ebaa1bab0913512f2de1dc56623381f14d11..ce5363c7e71130e5503bc5e18760b1cf8985ed52 100644 (file)
@@ -111,26 +111,26 @@ struct group_workspace {
 #endif
 };
 
-static gid_t get_group_gid(const char *optarg)
+static gid_t get_group_gid(const char *group)
 {
        struct group *gr;
        gid_t gid;
 
-       if ((gr = getgrnam(optarg)))
+       if ((gr = getgrnam(group)))
                return gr->gr_gid;
 
-       gid = strtou32_or_err(optarg, _("invalid group argument"));
+       gid = strtou32_or_err(group, _("invalid group argument"));
        if (!getgrgid(gid))
-               errx(EXIT_FAILURE, _("%s: unknown gid"), optarg);
+               errx(EXIT_FAILURE, _("%s: unknown gid"), group);
 
        return gid;
 }
 
-static struct group_workspace *init_group_workspace(const char *optarg)
+static struct group_workspace *init_group_workspace(const char *group)
 {
        struct group_workspace *buf = xmalloc(sizeof(struct group_workspace));
 
-       buf->requested_group = get_group_gid(optarg);
+       buf->requested_group = get_group_gid(group);
        buf->ngroups = sysconf(_SC_NGROUPS_MAX) + 1;  /* room for the primary gid */
        buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups);