chiark / gitweb /
don't write to sysfs files during test run
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 23 Mar 2007 16:18:03 +0000 (17:18 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 23 Mar 2007 16:18:03 +0000 (17:18 +0100)
udev_rules.c

index f8844a8..5078f2d 100644 (file)
@@ -861,8 +861,9 @@ try_parent:
                        info("writing '%s' to sysfs file '%s'", value, attr);
                        f = fopen(attr, "w");
                        if (f != NULL) {
-                               if (fprintf(f, "%s", value) <= 0)
-                                       err("error writing ATTR{%s}: %s", attr, strerror(errno));
+                               if (!udev->test_run)
+                                       if (fprintf(f, "%s", value) <= 0)
+                                               err("error writing ATTR{%s}: %s", attr, strerror(errno));
                                fclose(f);
                        } else
                                err("error opening ATTR{%s} for writing: %s", attr, strerror(errno));