chiark / gitweb /
ignore device node names while restoring symlinks from the stack
[elogind.git] / udevinfo.c
index 82057de54c566b9dd8469b7c5bf5583c4e888d95..be9aa769e10f46352039dbdb93e0d723d5dc89d6 100644 (file)
@@ -79,6 +79,8 @@ static void print_all_attributes(const char *devpath, const char *key)
                        if (attr_value == NULL)
                                continue;
                        len = strlcpy(value, attr_value, sizeof(value));
+                       if(len >= sizeof(value))
+                               len = sizeof(value) - 1;
                        dbg("attr '%s'='%s'(%zi)", dent->d_name, value, len);
 
                        /* remove trailing newlines */
@@ -265,7 +267,6 @@ int main(int argc, char *argv[], char *envp[])
                goto exit;
        }
 
-       /* get command line options */
        while (1) {
                option = getopt_long(argc, argv, "aen:p:q:rVh", options, NULL);
                if (option == -1)
@@ -279,7 +280,7 @@ int main(int argc, char *argv[], char *envp[])
                                strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name));
                        else
                                strlcpy(name, optarg, sizeof(name));
-                       dbg("name: %s\n", name);
+                       dbg("name: %s", name);
                        break;
                case 'p':
                        /* remove /sys if given */
@@ -287,10 +288,9 @@ int main(int argc, char *argv[], char *envp[])
                                strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path));
                        else
                                strlcpy(path, optarg, sizeof(path));
-                       dbg("path: %s\n", path);
+                       dbg("path: %s", path);
                        break;
                case 'q':
-                       dbg("udev query: %s\n", optarg);
                        action = ACTION_QUERY;
                        if (strcmp(optarg, "name") == 0) {
                                query = QUERY_NAME;