[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) be
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command. |
Date: |
Mon, 7 Jan 2019 18:40:58 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Jan 07, 2019 at 06:50:53PM +0100, Max Reitz wrote:
[...]
I don't particularly care how we fix this, but it breaks the nbdkit
tests on FreeBSD so I am keen to fix it one way or another.
> And if optreset not being available for glibc is the only issue, I'd say
> adding it as a weak global variable would work without #ifdefs.
The weak global variable doesn't make the code "#ifdef free". I tried
a patch like this:
+int optreset __attribute__((weak));
...
static int command(...)
{
...
optind = 0;
+ optreset = 1;
...
}
but that still doesn't work on FreeBSD.
You have to set optind=1 apparently. So if we want to set optreset=1
we still end up with #ifdef __FreeBSD__. The final patch will
end up looking something like:
static int command(...)
{
...
+#ifdef __FreeBSD__
+ optind = 1;
+ optreset = 1;
+#else
optind = 0;
+#endif
...
}
If you want me to submit a formal patch like this let me know.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
- [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Richard W.M. Jones, 2019/01/03
- [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Richard W.M. Jones, 2019/01/03
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Eric Blake, 2019/01/03
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Max Reitz, 2019/01/07
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Eric Blake, 2019/01/07
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Max Reitz, 2019/01/07
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Eric Blake, 2019/01/07
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Max Reitz, 2019/01/07
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Eric Blake, 2019/01/07
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Max Reitz, 2019/01/09
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command.,
Richard W.M. Jones <=
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Kevin Wolf, 2019/01/08
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Eric Blake, 2019/01/08
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Kevin Wolf, 2019/01/08
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Richard W.M. Jones, 2019/01/08
- Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command., Max Reitz, 2019/01/09