From patchwork Fri Jul 18 12:54:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 4583211 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9FB3D9F26C for ; Fri, 18 Jul 2014 12:59:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D77A6200D9 for ; Fri, 18 Jul 2014 12:59:05 +0000 (UTC) Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mail.kernel.org (Postfix) with ESMTP id A8E9A2018E for ; Fri, 18 Jul 2014 12:59:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6ICt0XP005787; Fri, 18 Jul 2014 08:55:00 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s6ICsxTL005974 for ; Fri, 18 Jul 2014 08:54:59 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6ICsx36018102 for ; Fri, 18 Jul 2014 08:54:59 -0400 Received: from sf2.bxl.stone.is (sf2.bxl.stone.is [5.134.1.239]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6ICsuQD026933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 Jul 2014 08:54:57 -0400 Received: from [87.238.167.34] (helo=smtprelay.1eurohost.com) by sf2.bxl.stone.is with esmtp (Exim 4.82) (envelope-from ) id 1X87gc-0005L8-Cn; Fri, 18 Jul 2014 14:54:56 +0200 Received: from vz19.stone-is.net (vz19.stone-is.net [87.238.162.57]) by smtprelay.1eurohost.com (Postfix) with ESMTP id 2D2022208FB; Fri, 18 Jul 2014 14:54:53 +0200 (CEST) X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.117] (178-119-65-67.access.telenet.be [178.119.65.67]) by vz19.stone-is.net (Postfix) with ESMTPSA id 89FD889203; Fri, 18 Jul 2014 14:54:54 +0200 (CEST) Message-ID: <53C9191C.4070705@acm.org> Date: Fri, 18 Jul 2014 14:54:52 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: christophe.varoqui@opensvc.com References: <53C91871.9070402@acm.org> In-Reply-To: <53C91871.9070402@acm.org> X-Enigmail-Version: 1.6 X-Filter-ID: XtLePq6GTMn8G68F0EmQvdthj6rk7ohlAkaRQG+cDaLZlN3ufQ0ZRHdy43341LQ0JYRGiu4wDuX/ sGw1Y7RAsQVCOi2K3ZygpdQwUC1xM8uHTLHcW1YhPsFnFxvjWlQPLZy1RAw8+2yZuh2VuYuU9z8U a6+MdljsDo+RKX0yPPDwoVJnpeAWJjfTvWCbG36LwJOqJV51iSPXek1m27w/m+HNZvRbeH/WodDC Pyd1hEHbiTiodCOnGJJ238+JDuVLGhKp8JQMCZJZaql8QZpmqX9T+OwfgRcaB9RPsshfI97D4gz4 tcU5YI1KNYsC2/V3glLeZCD1voA8s0bkUEtPw/GX+ObfaU6whL8xq/xH+as21Cee63EeltfbuaMM NA5XR/lhzJ4Pd6XOYPUh1LatWl4K/BrAvODv+H53lohFBx5WhVa6zifUH6X26a/6lVhrtJVcNrFf 4GaM5Eg5slNOY1NHQAvSZpDy3ysxabiXOiY8rN5kPduYoOjRk/4SxcBWjjQNtXRKSR1sOD289304 szpgkzbBMkWtGTUmSRdnNNTqrNZ1EgtZond7q2FKC0V2DjB8+DxmdJyMgaP/BJhXML08KlEIRB/1 zhErtZP4jFj74O4hBSz/kkmPgL+fgIguP7zVxQ8/MinsvL3XSVaM87zsNy3vhxHFEhzEUW2s4y8l G+iucR8wMCVHyHsimo/bhMIZHdSilwF/ZU2dwKqv4A== X-Report-Abuse-To: spam@sf1.bxl.stone.is X-Filter-Fingerprint: cPaH8lomer6UwsJ3BnJDysg56Hzi1baYmi2c/60G48S0VFDyP20las9Mq1v6nXmfrqKtWpHLpkE8 c09GKJn2ty9RbgfMznzpLqxl2iuvQkLd1PHxHTVUQ6kKwyUfwBkXbbcemmvc6LV6reHAmFfSz0ej vfBM5HDil32B6EA6ECAwtB2mFrRhH9FyTxY8sWyBQlDA+Ppc0qKzy59UBiMObJjp2wMQvksbXuh+ Zur/YDgNaJU0bkU579fapNXDRWH7lv8Ffx5tjiiMQ9xvR0covSWj1kd0N16AJIzbHn3urryUOSbt rhiR0dBuPv/XixcLgZGW1Q2YRaufTGd4ws1788KKGz4SH7FWti8gG83XdVBmLcRjbh4tt+C7QLi/ d0JLh7cxcjsgBTxNJWWHM9ZBsyb0iDyxIyoedIlOoGOP+kg4WNW5IE3LlEe0p1AaVStrnfW5fBRH 93BuV4EXYIb6Ew== X-Originating-IP: 87.238.167.34 X-SpamExperts-Domain: stone.is X-SpamExperts-Username: 87.238.167.34 Authentication-Results: bxl.stone.is; auth=pass smtp.auth=87.238.167.34 X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.07) X-Recommended-Action: accept X-RedHat-Spam-Score: -1.235 (BAYES_00,SPF_SOFTFAIL) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: device-mapper development , Sebastian Herbszt Subject: [dm-devel] [PATCH 5/5] libmultipath: Accept "*" as a valid regular expression X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Inside libmultipath regcomp() is used to compile regular expressions specified in /etc/multipath.conf. Many multipath.conf examples contain 'product_type "*"'. However, "*" is not a valid POSIX regular expression. Hence this patch that changes the regular expression "*" into ".*". Signed-off-by: Bart Van Assche --- libmultipath/blacklist.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c index 651bd7e..e5c287e 100644 --- a/libmultipath/blacklist.c +++ b/libmultipath/blacklist.c @@ -63,6 +63,13 @@ alloc_ble_device (vector blist) return 0; } +static int lm_regcomp(regex_t *preg, const char *pattern, int cflags) +{ + if (strcmp(pattern, "*") == 0) + pattern = ".*"; + return regcomp(preg, pattern, cflags); +} + extern int set_ble_device (vector blist, char * vendor, char * product, int origin) { @@ -77,16 +84,16 @@ set_ble_device (vector blist, char * vendor, char * product, int origin) return 1; if (vendor) { - if (regcomp(&ble->vendor_reg, vendor, - REG_EXTENDED|REG_NOSUB)) { + if (lm_regcomp(&ble->vendor_reg, vendor, + REG_EXTENDED|REG_NOSUB)) { FREE(vendor); return 1; } ble->vendor = vendor; } if (product) { - if (regcomp(&ble->product_reg, product, - REG_EXTENDED|REG_NOSUB)) { + if (lm_regcomp(&ble->product_reg, product, + REG_EXTENDED|REG_NOSUB)) { FREE(product); return 1; }