summaryrefslogtreecommitdiff
path: root/udevd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-03-14 21:41:33 +0100
committerKay Sievers <kay.sievers@vrfy.org>2007-03-14 21:41:33 +0100
commit9c6ad9fbbac82e517f5e748ddbe166f96f120afe (patch)
tree2021ceed05626469a75280a6c1b5cc897e157a75 /udevd.c
parent5edec024b1ed7bbdf73095791c13df324038c31d (diff)
encode db-file names, instead of just replacing '/'
Diffstat (limited to 'udevd.c')
-rw-r--r--udevd.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/udevd.c b/udevd.c
index 961ceb587a..07f1c48103 100644
--- a/udevd.c
+++ b/udevd.c
@@ -167,7 +167,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st
{
char filename[PATH_SIZE];
char filename_failed[PATH_SIZE];
- size_t start, end, i;
+ size_t start;
struct udevd_uevent_msg *loop_msg;
int fd;
@@ -175,27 +175,15 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st
strlcpy(filename, udev_root, sizeof(filename));
strlcat(filename, "/", sizeof(filename));
start = strlcat(filename, EVENT_QUEUE_DIR, sizeof(filename));
- end = strlcat(filename, msg->devpath, sizeof(filename));
- if (end > sizeof(filename))
- end = sizeof(filename);
-
- /* replace '/' to transform path into a filename */
- for (i = start+1; i < end; i++)
- if (filename[i] == '/')
- filename[i] = PATH_TO_NAME_CHAR;
+ strlcat(filename, msg->devpath, sizeof(filename));
+ path_encode(&filename[start+1], sizeof(filename) - (start+1));
/* add location of failed files */
strlcpy(filename_failed, udev_root, sizeof(filename_failed));
strlcat(filename_failed, "/", sizeof(filename_failed));
start = strlcat(filename_failed, EVENT_FAILED_DIR, sizeof(filename_failed));
- end = strlcat(filename_failed, msg->devpath, sizeof(filename_failed));
- if (end > sizeof(filename_failed))
- end = sizeof(filename_failed);
-
- /* replace '/' to transform path into a filename */
- for (i = start+1; i < end; i++)
- if (filename_failed[i] == '/')
- filename_failed[i] = PATH_TO_NAME_CHAR;
+ strlcat(filename_failed, msg->devpath, sizeof(filename_failed));
+ path_encode(&filename_failed[start+1], sizeof(filename) - (start+1));
switch (state) {
case EVENT_QUEUED: