X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=udev%2Fudev-rules.c;h=4713352826d524daaff101ee72dcd31d85af19fa;hb=e230e966f44c0ebb4954cbd30740384e14c1ca0f;hp=40947685d0125ffb3b2b789eddf2694a2093a0be;hpb=3f3aa9f57cdd1aacf9fba1c90bacd1840392b7e8;p=elogind.git diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 40947685d..471335282 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1528,7 +1528,6 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) { - struct dirent *ent; DIR *dir; char filename[UTIL_PATH_SIZE]; @@ -1540,26 +1539,28 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis } while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') + struct dirent *dent; + + dent = readdir(dir); + if (dent == NULL || dent->d_name[0] == '\0') break; - if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) + if (dent->d_name[0] == '.') continue; /* look for file matching with specified suffix */ if (suffix != NULL) { const char *ext; - ext = strrchr(ent->d_name, '.'); + ext = strrchr(dent->d_name, '.'); if (ext == NULL) continue; if (strcmp(ext, suffix) != 0) continue; } - dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); + dbg(udev, "put file '%s/%s' into list\n", dirname, dent->d_name); - snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); + snprintf(filename, sizeof(filename), "%s/%s", dirname, dent->d_name); filename[sizeof(filename)-1] = '\0'; udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); } @@ -1709,7 +1710,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) rules->buf_max = rules->buf_cur; } } - info(udev, "shrunk to %lu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + info(udev, "shrunk to %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); /* cleanup uid/gid cache */