]> granicus.if.org Git - cronie/commitdiff
cron: fix variable shadowing
authorSami Kerola <kerolasa@iki.fi>
Sun, 31 Mar 2019 11:52:33 +0000 (12:52 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2019 05:11:45 +0000 (06:11 +0100)
cronnext.c: In function 'matchuser':
cronnext.c:193:21: warning: declaration of 'user' shadows a global declaration [-Wshadow]
 int matchuser(char *user, char *list) {
                     ^~~~
In file included from funcs.h:37:0,
                 from cronnext.c:32:
structs.h:71:3: note: shadowed declaration is here
 } user;

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/.dirstamp [new file with mode: 0644]
src/cronnext.c

diff --git a/src/.dirstamp b/src/.dirstamp
new file mode 100644 (file)
index 0000000..e69de29
index b6864ab40ada4b385194711c3aace8bcc2310b97..bd6545b8da3c7f0d314c96a197918d7ed7bb5594 100644 (file)
@@ -197,11 +197,11 @@ time_t nextmatch(entry *e, time_t start, time_t end) {
 /*
  * match a user against a list
  */
-int matchuser(char *user, char *list) {
+int matchuser(char *user_name, char *list) {
        char *pos;
-       size_t l = strlen(user);
+       size_t l = strlen(user_name);
 
-       for (pos = list; (pos = strstr(pos, user)) != NULL; pos += l) {
+       for (pos = list; (pos = strstr(pos, user_name)) != NULL; pos += l) {
                if ((pos != list) && (*(pos - 1) != ','))
                        continue;
                if ((pos[l] != '\0') && (pos[l] != ','))