summaryrefslogtreecommitdiff
path: root/udev_multiplex.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-03-07 04:29:43 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:51:00 -0700
commit63f61c5cf639953aa38e025485919b0aa1c49b59 (patch)
tree2392041b5aef6984384cf044371ec2d9716014d4 /udev_multiplex.c
parent56a8a624eef99f5324b54fad466b144aa4f882c2 (diff)
[PATCH] replace strncpy()/strncat() by strlcpy()/strlcat()
Diffstat (limited to 'udev_multiplex.c')
-rw-r--r--udev_multiplex.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/udev_multiplex.c b/udev_multiplex.c
index 6d7852dbc0..3ef6e1707a 100644
--- a/udev_multiplex.c
+++ b/udev_multiplex.c
@@ -28,6 +28,7 @@
#include <fcntl.h>
#include "udev.h"
+#include "udev_libc_wrapper.h"
#include "udev_utils.h"
#include "logging.h"
@@ -72,22 +73,22 @@ static int run_program(struct udevice *udev, const char *filename)
*/
void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix)
{
- char dirname[PATH_MAX];
+ char dirname[PATH_SIZE];
/* chop the device name up into pieces based on '/' */
if (udev->name[0] != '\0') {
- char devname[NAME_SIZE];
+ char devname[PATH_SIZE];
char *temp;
- strfieldcpy(devname, udev->name);
+ strlcpy(devname, udev->name, sizeof(devname));
temp = strchr(devname, '/');
while (temp != NULL) {
temp[0] = '\0';
/* don't call the subsystem directory here */
if (strcmp(devname, udev->subsystem) != 0) {
- snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname);
- dirname[PATH_MAX-1] = '\0';
+ snprintf(dirname, sizeof(dirname), "%s/%s", basedir, devname);
+ dirname[sizeof(dirname)-1] = '\0';
call_foreach_file(run_program, udev, dirname, suffix);
}
@@ -98,18 +99,18 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c
}
if (udev->name[0] != '\0') {
- snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name);
- dirname[PATH_MAX-1] = '\0';
+ snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->name);
+ dirname[sizeof(dirname)-1] = '\0';
call_foreach_file(run_program, udev, dirname, suffix);
}
if (udev->subsystem[0] != '\0') {
- snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem);
- dirname[PATH_MAX-1] = '\0';
+ snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->subsystem);
+ dirname[sizeof(dirname)-1] = '\0';
call_foreach_file(run_program, udev, dirname, suffix);
}
- snprintf(dirname, PATH_MAX, "%s/default", basedir);
- dirname[PATH_MAX-1] = '\0';
+ snprintf(dirname, sizeof(dirname), "%s/default", basedir);
+ dirname[sizeof(dirname)-1] = '\0';
call_foreach_file(run_program, udev, dirname, suffix);
}