From 233d9f4803cb16626ac495e794e46698cc310512 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 15 Jan 2012 17:23:50 +0100 Subject: [PATCH] Do not treat repositories with trailing '/' chars as invalid. --- NEWS | 3 +++ etc/xbps.conf | 4 ++-- lib/repository_pool.c | 20 +++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 93714834..33f214bb 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.12.0 (???): + * Fixed registerring repositories with trailing '/' chars in + configuration file: xbps.conf. + * xbps-repo(8): the 'genindex' target now creates a plist file to cache all files provided by binary packages in a repository. This makes the 'find-files' target marginally faster, because this avoids having diff --git a/etc/xbps.conf b/etc/xbps.conf index 133eccb8..5fcf9085 100644 --- a/etc/xbps.conf +++ b/etc/xbps.conf @@ -42,8 +42,8 @@ # or name will be used. # # By default we use the official "public" repositories. You can add -# your own repositories by specifying the path (without the trailing -# '/' character) to the directory where the index.plist file is stored. +# your own repositories by specifying the path to the directory +# where the index.plist file is stored. # # Repositories not matching the host architecture are simply ignored. # diff --git a/lib/repository_pool.c b/lib/repository_pool.c index 10c917a0..715e30c8 100644 --- a/lib/repository_pool.c +++ b/lib/repository_pool.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -46,21 +47,18 @@ static bool check_repo_arch(const char *uri) { struct utsname un; - char *p; + char *p, *b; + + if ((p = strdup(uri)) == NULL) + return false; uname(&un); - p = strrchr(uri, '/'); - if (p == NULL) + b = basename(p); + free(p); + if ((strcmp(b, "noarch")) && (strcmp(b, un.machine))) return false; - p++; - if (*p == '\0') - return false; - else if (strcmp(p, "noarch") == 0) - return true; - else if (strcmp(p, un.machine) == 0) - return true; - return false; + return true; } int HIDDEN