summaryrefslogtreecommitdiff
path: root/dev_d.c
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2004-03-24 23:31:04 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:12 -0700
commit1f5caf43c88a247d36d1c8362009cda59f3ac729 (patch)
tree987f7eece3b5f707990ab73276417354d4952acd /dev_d.c
parentf61d732a02c8a5e11c39651a70e3e3fd00529495 (diff)
[PATCH] actually have udev run files ending in .dev in the /etc/dev.d/ directory as documented.
Diffstat (limited to 'dev_d.c')
-rw-r--r--dev_d.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/dev_d.c b/dev_d.c
index 36bee33bd9..9412c3da77 100644
--- a/dev_d.c
+++ b/dev_d.c
@@ -36,6 +36,7 @@
#include "logging.h"
#define HOTPLUGDIR "/etc/dev.d"
+#define SUFFIX ".dev"
#define COMMENT_PREFIX '#'
static void run_program(char *name)
@@ -64,7 +65,8 @@ static void execute_dir (char *dirname)
{
DIR *directory;
struct dirent *entry;
- char filename[256];
+ char filename[NAME_SIZE];
+ int name_len;
dbg("opening %s", dirname);
directory = opendir(dirname);
@@ -80,6 +82,13 @@ static void execute_dir (char *dirname)
(entry->d_name[0] == COMMENT_PREFIX))
continue;
+ /* Nor do we run files that do not end in ".dev" */
+ name_len = strlen(entry->d_name);
+ if (name_len < strlen(SUFFIX))
+ continue;
+ if (strcmp(&entry->d_name[name_len - sizeof (SUFFIX) + 1], SUFFIX) != 0)
+ continue;
+
/* FIXME - need to use file_list_insert() here to run these in sorted order... */
snprintf(filename, sizeof(filename), "%s%s", dirname, entry->d_name);
filename[sizeof(filename)-1] = '\0';