chiark / gitweb /
[PATCH] if using glibc, link dynamically, as no one like 500Kb udev binaries...
[elogind.git] / namedev.c
index 949c2eedf681c6cc34dad8d0037197add32ba1bc..cff338f1a719b635c06a33c765d2376f46869f4b 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -200,11 +200,12 @@ static void apply_format(struct udevice *udev, unsigned char *string)
                        case 'D':
                                if (strlen(udev->kernel_number) == 0) {
                                        strcat(pos, "disc");
+                                       dbg("substitute devfs disc");
                                        break;
                                }
                                strcat(pos, "part");
                                strcat(pos, udev->kernel_number);
-                               dbg("substitute kernel number '%s'", udev->kernel_number);
+                               dbg("substitute devfs part '%s'", udev->kernel_number);
                                break;
                        case 'm':
                                sprintf(pos, "%u", udev->minor);
@@ -229,8 +230,10 @@ static void apply_format(struct udevice *udev, unsigned char *string)
                                                        break;
                                                }
                                        }
-                                       strcat(pos, pos3);
-                                       dbg("substitute partial callout output '%s'", pos3);
+                                       if (pos3) {
+                                               strcat(pos, pos3);
+                                               dbg("substitute partial callout output '%s'", pos3);
+                                       }
                                } else {
                                        strcat(pos, udev->callout_value);
                                        dbg("substitute callout output '%s'", udev->callout_value);
@@ -652,9 +655,9 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de
                if (isdigit(class_dev->path[strlen(class_dev->path)-1])) {
                        temp = strrchr(filename, '/');
                        if (temp) {
+                               char *temp2 = strrchr(filename, '/');
                                partition = 1;
                                *temp = 0x00;
-                               char *temp2 = strrchr(filename, '/');
                                dbg("temp2 = %s", temp2);
                                if (temp2 && (strcmp(temp2, "/block") == 0)) {
                                        /* oops, we have no parent block device, so go back to original directory */