chiark / gitweb /
Merge branch 'docs/udev.xml' of git://github.com/mfwitten/udev
[elogind.git] / extras / firmware / firmware.c
index f7d21df..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;
-       FILE *fsource, *ftarget;
+       FILE *fsource = NULL, *ftarget = NULL;
        bool ret = false;
 
        buf = malloc(size);
@@ -112,8 +112,6 @@ int main(int argc, char **argv)
                        break;
                case 'h':
                        printf("Usage: firmware --firmware=<fwfile> --devpath=<path> [--help]\n\n");
-               default:
-                       rc = 1;
                        goto exit;
                }
        }
@@ -147,7 +145,7 @@ int main(int argc, char **argv)
        }
 
        util_path_encode(firmware, fwencpath, sizeof(fwencpath));
-       util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.run/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) {
@@ -159,11 +157,9 @@ int main(int argc, char **argv)
                        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;
-                       udev_selinux_resetfscreatecon(udev);
                } while (err == -ENOENT);
                rc = 2;
                set_loading(udev, loadpath, "-1");