Re: [PATCH] qga: Use gethostname() instead of g_get_host_name()

2020-06-22 Thread Michal Privoznik
On 6/22/20 12:14 PM, Philippe Mathieu-Daudé wrote: Hi Michal, On 6/16/20 10:34 AM, Michal Privoznik wrote: Problem with g_get_host_name() is that on the first call it saves the hostname into a global variable and from then on, every subsequent call returns the saved hostname. Even if the hostna

Re: [PATCH] qga: Use gethostname() instead of g_get_host_name()

2020-06-22 Thread Philippe Mathieu-Daudé
Hi Michal, On 6/16/20 10:34 AM, Michal Privoznik wrote: > Problem with g_get_host_name() is that on the first call it saves > the hostname into a global variable and from then on, every > subsequent call returns the saved hostname. Even if the hostname > changes. This doesn't play nicely with gues

Re: [PATCH] qga: Use gethostname() instead of g_get_host_name()

2020-06-22 Thread Michal Privoznik
On 6/19/20 11:54 PM, Richard Henderson wrote: On 6/16/20 1:34 AM, Michal Privoznik wrote: +#ifndef G_OS_WIN32 Nit: positive tests are easier to reason with and extend than negative tests. I would reverse these two blocks and use a positive test for windows. Also, CONFIG_WIN32 is what we use e

Re: [PATCH] qga: Use gethostname() instead of g_get_host_name()

2020-06-19 Thread Richard Henderson
On 6/16/20 1:34 AM, Michal Privoznik wrote: > +#ifndef G_OS_WIN32 Nit: positive tests are easier to reason with and extend than negative tests. I would reverse these two blocks and use a positive test for windows. Also, CONFIG_WIN32 is what we use elsewhere for this test. r~

Re: [PATCH] qga: Use gethostname() instead of g_get_host_name()

2020-06-16 Thread Marc-André Lureau
Hi On Tue, Jun 16, 2020 at 12:35 PM Michal Privoznik wrote: > Problem with g_get_host_name() is that on the first call it saves > the hostname into a global variable and from then on, every > subsequent call returns the saved hostname. Even if the hostname > changes. This doesn't play nicely wit