X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udevinfo.c;h=defed2ee31a96e38aeaae3d0346323d2af778097;hb=dde05ccb8d423fbc5c29f54b0c1b545938c8f151;hp=44eb1427092abfda36f78407ffe84aa410609308;hpb=d026a35d747c0a993281408a9644ab843cf89fdd;p=elogind.git diff --git a/udevinfo.c b/udevinfo.c index 44eb14270..defed2ee3 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -27,11 +27,12 @@ #include #include +#include "libsysfs/sysfs/libsysfs.h" +#include "libsysfs/dlist.h" #include "udev.h" #include "udev_version.h" #include "logging.h" #include "udevdb.h" -#include "libsysfs/libsysfs.h" # define SYSFS_VALUE_MAX 200 @@ -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; @@ -90,7 +91,7 @@ static int print_all_attributes(const char *path) len--; } if (len == 0) - printf(" SYSFS_%s=\"%s\"\n", attr->name, value); + printf(" SYSFS{%s}=\"%s\"\n", attr->name, value); } } printf("\n"); @@ -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;