Skip to content

Commit

Permalink
Merge pull request systemd#2701 from keszybz/udev-rules
Browse files Browse the repository at this point in the history
udev-rules cleanup fix
  • Loading branch information
poettering committed Feb 22, 2016
2 parents 9fe436a + 916a8d4 commit 4d080d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/udev/udev-rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,10 @@ static void attr_subst_subdir(char *attr, size_t len) {

for (dent = readdir(dir); dent != NULL; dent = readdir(dir))
if (dent->d_name[0] != '.') {
char n[strlen(dent->d_name) + 1 + strlen(tail) + 1];
char n[strlen(dent->d_name) + strlen(tail) + 1];

strscpyl(n, sizeof n, dent->d_name, "/", tail, NULL);
if (faccessat(dirfd(dir), n, F_OK, 0)) {
strscpyl(n, sizeof n, dent->d_name, tail, NULL);
if (faccessat(dirfd(dir), n, F_OK, 0) == 0) {
strscpyl(attr, len, path, n, NULL);
break;
}
Expand Down
7 changes: 7 additions & 0 deletions test/udev-test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
my $udev_bin = "./test-udev";
my $valgrind = 0;
my $gdb = 0;
my $strace = 0;
my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --track-origins=yes --quiet $udev_bin";
my $udev_bin_gdb = "gdb --args $udev_bin";
my $udev_bin_strace = "strace -efile $udev_bin";
my $udev_dev = "test/dev";
my $udev_run = "test/run";
my $udev_rules_dir = "$udev_run/udev/rules.d";
Expand Down Expand Up @@ -1330,6 +1332,8 @@ sub udev {
system("$udev_bin_valgrind $action $devpath");
} elsif ($gdb > 0) {
system("$udev_bin_gdb $action $devpath");
} elsif ($strace > 0) {
system("$udev_bin_strace $action $devpath");
} else {
system("$udev_bin", "$action", "$devpath");
}
Expand Down Expand Up @@ -1509,6 +1513,9 @@ sub run_test {
} elsif ($arg =~ m/--gdb/) {
$gdb = 1;
printf("using gdb\n");
} elsif ($arg =~ m/--strace/) {
$strace = 1;
printf("using strace\n");
} else {
push(@list, $arg);
}
Expand Down

0 comments on commit 4d080d7

Please sign in to comment.