chiark / gitweb /
logind: remove unused session->closing field
[elogind.git] / src / udev / udev-builtin-firmware.c
index 2fb75a7335c9762fc6e13a7ac07a1bb9b9357a6e..b80940b6efde9bed416f26d1135e952e94c0ccd8 100644 (file)
@@ -78,8 +78,6 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
 {
         struct udev *udev = udev_device_get_udev(dev);
         static const char *searchpath[] = { FIRMWARE_PATH };
-        char fwencpath[UTIL_PATH_SIZE];
-        char misspath[UTIL_PATH_SIZE];
         char loadpath[UTIL_PATH_SIZE];
         char datapath[UTIL_PATH_SIZE];
         char fwpath[UTIL_PATH_SIZE];
@@ -100,34 +98,21 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
         /* lookup firmware file */
         uname(&kernel);
         for (i = 0; i < ELEMENTSOF(searchpath); i++) {
-                util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL);
+                strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL);
                 fwfile = fopen(fwpath, "re");
                 if (fwfile != NULL)
                         break;
 
-                util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL);
+                strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL);
                 fwfile = fopen(fwpath, "re");
                 if (fwfile != NULL)
                         break;
         }
 
-        util_path_encode(firmware, fwencpath, sizeof(fwencpath));
-        util_strscpyl(misspath, sizeof(misspath), "/run/udev/firmware-missing/", fwencpath, NULL);
-        util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
+        strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
 
         if (fwfile == NULL) {
-                int err;
-
-                /* This link indicates the missing firmware file and the associated device */
                 log_debug("did not find firmware file '%s'\n", firmware);
-                do {
-                        err = mkdir_parents(misspath, 0755);
-                        if (err != 0 && err != -ENOENT)
-                                break;
-                        err = symlink(udev_device_get_devpath(dev), misspath);
-                        if (err != 0)
-                                err = -errno;
-                } while (err == -ENOENT);
                 rc = EXIT_FAILURE;
                 /*
                  * Do not cancel the request in the initrd, the real root might have
@@ -140,16 +125,16 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
         }
 
         if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) {
+                if (!in_initrd())
+                        set_loading(udev, loadpath, "-1");
                 rc = EXIT_FAILURE;
                 goto exit;
         }
-        if (unlink(misspath) == 0)
-                util_delete_path(udev, misspath);
 
         if (!set_loading(udev, loadpath, "1"))
                 goto exit;
 
-        util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
+        strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
         if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {
                 log_error("error sending firmware '%s' to device\n", firmware);
                 set_loading(udev, loadpath, "-1");