chiark / gitweb /
Merge branch 'docs/udev.xml' of git://github.com/mfwitten/udev
[elogind.git] / extras / firmware / firmware.c
index 92f0918..36ce790 100644 (file)
@@ -43,7 +43,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state)
 static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size)
 {
        char *buf;
 static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size)
 {
        char *buf;
-       FILE *fsource, *ftarget;
+       FILE *fsource = NULL, *ftarget = NULL;
        bool ret = false;
 
        buf = malloc(size);
        bool ret = false;
 
        buf = malloc(size);
@@ -79,10 +79,7 @@ int main(int argc, char **argv)
                { "help", no_argument, NULL, 'h' },
                {}
        };
                { "help", no_argument, NULL, 'h' },
                {}
        };
-       static const char *searchpath[] = {
-               "/lib/firmware/updates/",
-               "/lib/firmware/"
-       };
+       static const char *searchpath[] = { FIRMWARE_PATH };
        char fwencpath[UTIL_PATH_SIZE];
        char misspath[UTIL_PATH_SIZE];
        char loadpath[UTIL_PATH_SIZE];
        char fwencpath[UTIL_PATH_SIZE];
        char misspath[UTIL_PATH_SIZE];
        char loadpath[UTIL_PATH_SIZE];
@@ -115,8 +112,6 @@ int main(int argc, char **argv)
                        break;
                case 'h':
                        printf("Usage: firmware --firmware=<fwfile> --devpath=<path> [--help]\n\n");
                        break;
                case 'h':
                        printf("Usage: firmware --firmware=<fwfile> --devpath=<path> [--help]\n\n");
-               default:
-                       rc = 1;
                        goto exit;
                }
        }
                        goto exit;
                }
        }
@@ -150,7 +145,7 @@ int main(int argc, char **argv)
        }
 
        util_path_encode(firmware, fwencpath, sizeof(fwencpath));
        }
 
        util_path_encode(firmware, fwencpath, sizeof(fwencpath));
-       util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL);
+       util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL);
        util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
 
        if (fwfile == NULL) {
        util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
 
        if (fwfile == NULL) {
@@ -162,11 +157,9 @@ int main(int argc, char **argv)
                        err = util_create_path(udev, misspath);
                        if (err != 0 && err != -ENOENT)
                                break;
                        err = util_create_path(udev, misspath);
                        if (err != 0 && err != -ENOENT)
                                break;
-                       udev_selinux_setfscreatecon(udev, misspath, S_IFLNK);
                        err = symlink(devpath, misspath);
                        if (err != 0)
                                err = -errno;
                        err = symlink(devpath, misspath);
                        if (err != 0)
                                err = -errno;
-                       udev_selinux_resetfscreatecon(udev);
                } while (err == -ENOENT);
                rc = 2;
                set_loading(udev, loadpath, "-1");
                } while (err == -ENOENT);
                rc = 2;
                set_loading(udev, loadpath, "-1");