chiark / gitweb /
[PATCH] add new TODO item about local user permissions.
[elogind.git] / udevinfo.c
index 7991855b2812de55bec6567b27d9452f87ae36d0..defed2ee31a96e38aeaae3d0346323d2af778097 100644 (file)
@@ -26,8 +26,9 @@
 #include <stdarg.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sysfs/libsysfs.h>
 
+#include "libsysfs/sysfs/libsysfs.h"
+#include "libsysfs/dlist.h"
 #include "udev.h"
 #include "udev_version.h"
 #include "logging.h"
@@ -72,7 +73,7 @@ static int print_all_attributes(const char *path)
 
        dlist_for_each_data(attributes, attr, struct sysfs_attribute) {
                if (attr->value != NULL) {
-                       strncpy(value, attr->value, SYSFS_VALUE_MAX);
+                       strfieldcpy(value, attr->value);
                        len = strlen(value);
                        if (len == 0)
                                continue;
@@ -305,8 +306,8 @@ static int process_options(void)
                        } else {
                                if (path[0] != '/') {
                                        /* prepend '/' if missing */
-                                       strcat(temp, "/");
-                                       strncat(temp, path, sizeof(path));
+                                       strfieldcat(temp, "/");
+                                       strfieldcat(temp, path);
                                        pos = temp;
                                } else {
                                        pos = path;
@@ -342,7 +343,7 @@ print:
                case NAME:
                        if (root)
                                strfieldcpy(result, udev_root);
-                       strncat(result, dev.name, sizeof(result));
+                       strfieldcat(result, dev.name);
                        break;
 
                case SYMLINK:
@@ -384,7 +385,7 @@ exit:
                                /* prepend sysfs mountpoint if not given */
                                strfieldcpy(temp, path);
                                strfieldcpy(path, sysfs_path);
-                               strncat(path, temp, sizeof(path));
+                               strfieldcat(path, temp);
                        }
                        print_device_chain(path);
                        return 0;