summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-26 02:31:54 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-10-26 02:31:54 +0100
commit1822e9b033fcd91a7dfd3b0bfd12cfbbd93fc470 (patch)
treed9c37e4dc229d815686de1ae68f07bae63b605c3 /udev
parent21cfb0436c736c262baa37d96625041e3a96db07 (diff)
do not init string arrays, just clear first byte
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-event.c3
-rw-r--r--udev/udev-node.c6
-rw-r--r--udev/udev-rules.c3
3 files changed, 8 insertions, 4 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index fcb9993709..e297df0383 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -291,9 +291,10 @@ found:
err(event->udev, "missing file parameter for attr\n");
else {
const char *val;
- char value[UTIL_NAME_SIZE] = "";
+ char value[UTIL_NAME_SIZE];
size_t size;
+ value[0] = '\0';
util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1);
val = udev_device_get_sysattr_value(event->dev, attr);
diff --git a/udev/udev-node.c b/udev/udev-node.c
index b39100dcee..e402dc9de3 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -143,7 +143,7 @@ exit:
static int node_symlink(struct udev *udev, const char *node, const char *slink)
{
struct stat stats;
- char target[UTIL_PATH_SIZE] = "";
+ char target[UTIL_PATH_SIZE];
char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
int i = 0;
int tail = 0;
@@ -151,6 +151,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink)
int err = 0;
/* use relative link */
+ target[0] = '\0';
while (node[i] && (node[i] == slink[i])) {
if (node[i] == '/')
tail = i+1;
@@ -272,7 +273,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test)
struct udev *udev = udev_device_get_udev(dev);
struct udev_list_node dev_list;
struct udev_list_entry *dev_entry;
- char target[UTIL_PATH_SIZE] = "";
+ char target[UTIL_PATH_SIZE];
int count;
int priority = 0;
int rc = 0;
@@ -294,6 +295,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test)
}
/* find the device with the highest priority */
+ target[0] = '\0';
udev_list_entry_foreach(dev_entry, udev_list_get_entry(&dev_list)) {
const char *syspath;
struct udev_device *dev_db;
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index 1647f5cb09..a6f9220352 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -547,11 +547,12 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout)
{
struct udev *udev = udev_device_get_udev(dev);
char filepath[UTIL_PATH_SIZE];
- char devicepath[UTIL_PATH_SIZE] = "";
+ char devicepath[UTIL_PATH_SIZE];
struct stat stats;
int loop = timeout * WAIT_LOOP_PER_SECOND;
/* a relative path is a device attribute */
+ devicepath[0] = '\0';
if (file[0] != '/') {
util_strlcpy(devicepath, udev_get_sys_path(udev), sizeof(devicepath));
util_strlcat(devicepath, udev_device_get_devpath(dev), sizeof(devicepath));