diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-16 14:26:15 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-16 14:26:15 +0200 |
commit | f2860bf6d332cbbfd2d4d9afadb0148cf061fad2 (patch) | |
tree | b62a8cac9da67d1cb2aa628665526f33c044f35b | |
parent | 867ffb961672a226ba269b32c5d88a2c56b685fe (diff) | |
download | busybox-w32-f2860bf6d332cbbfd2d4d9afadb0148cf061fad2.tar.gz busybox-w32-f2860bf6d332cbbfd2d4d9afadb0148cf061fad2.tar.bz2 busybox-w32-f2860bf6d332cbbfd2d4d9afadb0148cf061fad2.zip |
mdev: fix non-working device deletion, add a test for that
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | testsuite/mdev.tests | 10 | ||||
-rw-r--r-- | util-linux/mdev.c | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests index c375fc774..a46929b3a 100755 --- a/testsuite/mdev.tests +++ b/testsuite/mdev.tests | |||
@@ -38,6 +38,16 @@ brw-rw---- 1 0 0 8,0 sda | |||
38 | SKIP= | 38 | SKIP= |
39 | 39 | ||
40 | # continuing to use directory structure from prev test | 40 | # continuing to use directory structure from prev test |
41 | optional STATIC FEATURE_MDEV_CONF FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME | ||
42 | testing "mdev deletes /block/sda" \ | ||
43 | "env - PATH=$PATH ACTION=remove DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; | ||
44 | ls -ln mdev.testdir/dev | $FILTER_LS" \ | ||
45 | "\ | ||
46 | " \ | ||
47 | "" "" | ||
48 | SKIP= | ||
49 | |||
50 | # continuing to use directory structure from prev test | ||
41 | rm -rf mdev.testdir/dev/* | 51 | rm -rf mdev.testdir/dev/* |
42 | echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf | 52 | echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf |
43 | echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf | 53 | echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf |
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index b4042c07e..cd6c1a89d 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -132,6 +132,7 @@ static void make_device(char *path, int delete) | |||
132 | major = -1; | 132 | major = -1; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | /* else: for delete, -1 still deletes the node, but < -1 suppresses that */ | ||
135 | 136 | ||
136 | /* Determine device name, type, major and minor */ | 137 | /* Determine device name, type, major and minor */ |
137 | device_name = (char*) bb_basename(path); | 138 | device_name = (char*) bb_basename(path); |
@@ -279,7 +280,7 @@ static void make_device(char *path, int delete) | |||
279 | if (aliaslink == '!' && s == a+1) { | 280 | if (aliaslink == '!' && s == a+1) { |
280 | val = st; | 281 | val = st; |
281 | /* "!": suppress node creation/deletion */ | 282 | /* "!": suppress node creation/deletion */ |
282 | major = -1; | 283 | major = -2; |
283 | } | 284 | } |
284 | else if (aliaslink == '>' || aliaslink == '=') { | 285 | else if (aliaslink == '>' || aliaslink == '=') { |
285 | val = st; | 286 | val = st; |
@@ -379,7 +380,7 @@ static void make_device(char *path, int delete) | |||
379 | free(command); | 380 | free(command); |
380 | } | 381 | } |
381 | 382 | ||
382 | if (delete && major >= 0) { | 383 | if (delete && major >= -1) { |
383 | if (ENABLE_FEATURE_MDEV_RENAME && alias) { | 384 | if (ENABLE_FEATURE_MDEV_RENAME && alias) { |
384 | if (aliaslink == '>') | 385 | if (aliaslink == '>') |
385 | unlink(device_name); | 386 | unlink(device_name); |