From: Christoph Egger <Christoph.Egger@amd.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: libxl: build fix
Date: Tue, 9 Nov 2010 12:39:51 +0100 [thread overview]
Message-ID: <201011091239.51488.Christoph.Egger@amd.com> (raw)
In-Reply-To: <19672.11522.721373.795832@mariner.uk.xensource.com>
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
On Monday 08 November 2010 18:01:54 Ian Jackson wrote:
> Look at the code and you will see that it assumes that basename does
> not modify its argument. I'm about to push a const-correctness fix
> which will make this more obvious and cause your broken attempt at a
> fix not to compile :-).
I rebased my source tree and yes, it does not compile.
> > > and the xl code, the version of
> > > basename() expected by the libxl cpuid code is the GNU one,
> > > not the POSIX one, and they have different semantics. I think we will
> > > have to open code an implementation of basename.
> >
> > Can you imagine to make Xen tools prefer POSIX over GNU in general,
> > please?
>
> I agree that the current code is a mistake. The POSIX basename is
> irritating and we shouldn't use it. Simply open coding a search for a
> '/' will be fine.
Attached patch replaces basename with strrchr(3).
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_buildxl.diff --]
[-- Type: text/x-diff, Size: 771 bytes --]
diff -r fcdab7bf732b -r 35070850561e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5323,7 +5323,7 @@ int main_tmem_freeable(int argc, char **
int main_cpupoolcreate(int argc, char **argv)
{
- const const char *filename = NULL;
+ const char *filename = NULL;
const char *p;
char extra_config[1024];
int dryrun = 0;
@@ -5430,7 +5430,7 @@ int main_cpupoolcreate(int argc, char **
if (!xlu_cfg_get_string (config, "name", &buf))
name = strdup(buf);
else
- name = basename(filename);
+ name = strrchr(filename, '/');
if (!libxl_name_to_cpupoolid(&ctx, name, &poolid)) {
fprintf(stderr, "Pool name \"%s\" already exists\n", name);
return -ERROR_FAIL;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2010-11-09 11:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-05 15:08 libxl: build fix Christoph Egger
2010-11-08 16:38 ` Ian Jackson
2010-11-08 16:53 ` Christoph Egger
2010-11-08 17:01 ` Ian Jackson
2010-11-09 11:39 ` Christoph Egger [this message]
2010-11-09 11:54 ` Ian Jackson
2010-11-09 12:58 ` Christoph Egger
2010-11-09 13:27 ` John Haxby
2010-11-09 17:03 ` Ian Jackson
-- strict thread matches above, loose matches on Subject: below --
2010-05-25 9:36 Christoph Egger
2010-05-27 14:41 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201011091239.51488.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.