Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
mdadm.5365
0096-Assemble-improve-tests-for-matching-name-r...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0096-Assemble-improve-tests-for-matching-name-request.patch of Package mdadm.5365
From 00f23a886134f1278aa61da3342f58d26f23f4d3 Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Wed, 22 Jul 2015 09:24:36 +1000 Subject: [PATCH 139/359] Assemble: improve tests for matching --name= request. References: bsc#1081910 If the name in the array has a home-host, then require that it matches, or is "any", or requested homehost is "any". Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Coly Li <colyli@suse.de> --- Assemble.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Assemble.c b/Assemble.c index 1960927..a3d020d 100644 --- a/Assemble.c +++ b/Assemble.c @@ -30,16 +30,21 @@ static int name_matches(char *found, char *required, char *homehost) /* See if the name found matches the required name, possibly * prefixed with 'homehost' */ - char fnd[33]; + char *sep; + unsigned int l; - strncpy(fnd, found, 32); - fnd[32] = 0; if (strcmp(found, required)==0) return 1; - if (homehost) { - int l = strlen(homehost); - if (l < 32 && fnd[l] == ':' && - strcmp(fnd+l+1, required)==0) + sep = strchr(found, ':'); + if (!sep) + return 0; + l = sep - found; + if (strncmp(found, "any:", 4) == 0 || + (homehost && strcmp(homehost, "any") == 0) || + (homehost && strlen(homehost) == l && + strncmp(found, homehost, l) == 0)) { + /* matching homehost */ + if (strcmp(sep+1, required) == 0) return 1; } return 0; -- 2.16.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor