On Wed, 2016-06-22 at 10:58 +0100, Richard W.M. Jones wrote:
On Wed, Jun 22, 2016 at 11:45:32AM +0200, Cédric Bosdonnat wrote:
> NetworkManager isn't provided on SLES. As yast2 lan is available on
> all
> openSUSE / SLE distro, use it instead.
> ---
> p2v/gui.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/p2v/gui.c b/p2v/gui.c
> index e720002..b50cadf 100644
> --- a/p2v/gui.c
> +++ b/p2v/gui.c
> @@ -51,6 +51,7 @@
>
> #include <config.h>
>
> +#include <sys/stat.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <stdarg.h>
There's an informal ordering for header files, and putting
<sys/stat.h> at the very top isn't in that tradition!
I suspected there would be some order, but couldn't really guess it
out.
> @@ -654,7 +655,11 @@ test_connection_ok (gpointer user_data)
> static void
> configure_network_button_clicked (GtkWidget *w, gpointer data)
> {
> - ignore_value (system ("nm-connection-editor &"));
> + struct stat statbuf;
> + if (stat ("/sbin/yast2", &statbuf) >= 0)
> + ignore_value (system ("yast2 lan &"));
> + else
> + ignore_value (system ("nm-connection-editor &"));
How about using access ("/sbin/yast2", X_OK)?
The reason is that I didn't know that function. Indeed, using it makes
more sense. I'll submit v2 promptly.
--
Cedric