chiark / gitweb /
do not init string arrays, just clear first byte
authorKay Sievers <kay.sievers@vrfy.org>
Sun, 26 Oct 2008 01:31:54 +0000 (02:31 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Sun, 26 Oct 2008 01:31:54 +0000 (02:31 +0100)
extras/edd_id/edd_id.c
extras/scsi_id/scsi_id.c
udev/udev-event.c
udev/udev-node.c
udev/udev-rules.c

index d7aec1488ccd5fe86dd714d20c1723c49d2ae8b8..4154387cb6ded8ab2fa9713067d7a3c981bedc41 100644 (file)
@@ -45,9 +45,9 @@ int main(int argc, char *argv[])
        int sysfs_fd;
        DIR *dir = NULL;
        int rc = 1;
        int sysfs_fd;
        DIR *dir = NULL;
        int rc = 1;
-       char match[NAME_MAX] = "";
+       char match[NAME_MAX];
 
 
-               udev = udev_new();
+       udev = udev_new();
        if (udev == NULL)
                goto exit;
 
        if (udev == NULL)
                goto exit;
 
@@ -124,6 +124,7 @@ int main(int argc, char *argv[])
        }
 
        /* lookup signature in sysfs to determine the name */
        }
 
        /* lookup signature in sysfs to determine the name */
+       match[0] = '\0';
        for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
                char file[UTIL_PATH_SIZE];
                char sysfs_id_buf[256];
        for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
                char file[UTIL_PATH_SIZE];
                char sysfs_id_buf[256];
index 86c76cfcc40bf11648a5df8e72baca8a70579147..45e48601f77e45e9385ca479badcb3184aa73f54 100644 (file)
@@ -579,8 +579,9 @@ static int scsi_id(struct udev *udev, char *maj_min_dev)
        struct scsi_id_device dev_scsi;
        int good_dev;
        int page_code;
        struct scsi_id_device dev_scsi;
        int good_dev;
        int page_code;
-       char serial_short[MAX_SERIAL_LEN] = "";
+       char serial_short[MAX_SERIAL_LEN];
 
 
+       serial_short[0] = '\0';
        set_inq_values(udev, &dev_scsi, maj_min_dev);
 
        /* get per device (vendor + model) options from the config file */
        set_inq_values(udev, &dev_scsi, maj_min_dev);
 
        /* get per device (vendor + model) options from the config file */
index fcb999370974db5624dcc510c8833b83e46adb47..e297df03834a62c94ae29cca47208bf1c0a51c53 100644 (file)
@@ -291,9 +291,10 @@ found:
                                err(event->udev, "missing file parameter for attr\n");
                        else {
                                const char *val;
                                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;
 
                                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);
                                util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1);
 
                                val = udev_device_get_sysattr_value(event->dev, attr);
index b39100dcee0a24f416cdeafb6d563e2c43bd9d85..e402dc9de38402334973b54187f7250c79e07304 100644 (file)
@@ -143,7 +143,7 @@ exit:
 static int node_symlink(struct udev *udev, const char *node, const char *slink)
 {
        struct stat stats;
 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;
        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 */
        int err = 0;
 
        /* use relative link */
+       target[0] = '\0';
        while (node[i] && (node[i] == slink[i])) {
                if (node[i] == '/')
                        tail = i+1;
        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;
        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;
        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 */
        }
 
        /* 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;
        udev_list_entry_foreach(dev_entry, udev_list_get_entry(&dev_list)) {
                const char *syspath;
                struct udev_device *dev_db;
index 1647f5cb097aa2555b6fbf12778b9342811ab1a1..a6f9220352de5fc6caa1542019ee7da81f487253 100644 (file)
@@ -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];
 {
        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 */
        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));
        if (file[0] != '/') {
                util_strlcpy(devicepath, udev_get_sys_path(udev), sizeof(devicepath));
                util_strlcat(devicepath, udev_device_get_devpath(dev), sizeof(devicepath));