Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: cecc4a5fd1e3f494d6f7cf2eeded1a5b77336336
Parent: 5710603c4af1d832f21a7583da5bd834606c4995
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Wed Jan 19 10:57:15 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Fri Jan 21 12:38:17 2011 -0600
fence_scsi: fix regular expression for grep
When fence_scsi checks to see if a specific keys is registered for a
specific device, it uses grep to look through a list of all registered
keys. The existing regular expression was not specific enough, and could
result in false positives. This patch fixes the problem by using anchors
to make the regular expression more specific.
Resolves: rhbz#670910
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 8ddde4e..818e1d9 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -71,7 +71,7 @@ sub do_action_off ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- my @keys = grep { /$node_key/ } get_registration_keys ($dev);
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
do_preempt_abort ($host_key, $node_key, $dev);
@@ -93,7 +93,7 @@ sub do_action_status ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- my @keys = grep { /$node_key/ } get_registration_keys ($dev);
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
$dev_count++;