summaryrefslogtreecommitdiff
path: root/udev_utils.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2006-12-08 09:48:53 +0100
committerKay Sievers <kay.sievers@vrfy.org>2006-12-08 09:48:53 +0100
commit9dd0c2573b1e3a6f18356e4db6cee5e5329ecb67 (patch)
tree70dcbc629bdc600aa48e8dab838d2a9f29cd697c /udev_utils.c
parent768cd81b7db0737240c759f59edd6d3399e1707a (diff)
rename config "filename" to "dir"
Diffstat (limited to 'udev_utils.c')
-rw-r--r--udev_utils.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/udev_utils.c b/udev_utils.c
index b6e5275a16..e892012132 100644
--- a/udev_utils.c
+++ b/udev_utils.c
@@ -126,7 +126,6 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c
{
struct dirent *ent;
DIR *dir;
- char *ext;
char filename[PATH_SIZE];
dbg("open directory '%s'", dirname);
@@ -145,14 +144,16 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c
continue;
/* look for file matching with specified suffix */
- ext = strrchr(ent->d_name, '.');
- if (ext == NULL)
- continue;
-
- if (strcmp(ext, suffix) != 0)
- continue;
-
- dbg("put file '%s/%s' in list", dirname, ent->d_name);
+ if (suffix != NULL) {
+ const char *ext;
+
+ ext = strrchr(ent->d_name, '.');
+ if (ext == NULL)
+ continue;
+ if (strcmp(ext, suffix) != 0)
+ continue;
+ }
+ dbg("put file '%s/%s' into list", dirname, ent->d_name);
snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name);
filename[sizeof(filename)-1] = '\0';