[PATCH] app/xinit: make startx's $? a useful value

Dan Nicholson dbn.lists at gmail.com
Sun May 3 10:05:49 PDT 2009


On Wed, Feb 11, 2009 at 3:18 PM, Andres Salomon <dilinger at queued.net> wrote:
>
> When startx fails to start X, it's most likely xinit that failed.  xinit
> returns a proper return code (1), but that gets clobbed in the startx
> script by clean-up commands.  This patch saves $? from xinit and forces
> startx to exit with that value.
>
> This way, if startx actually fails to start X, $? reflects that.
>
> Signed-off-by: Andres Salomon <dilinger at debian.org>
> ---
>  startx.cpp |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/startx.cpp b/startx.cpp
> index f911499..05d28e3 100644
> --- a/startx.cpp
> +++ b/startx.cpp
> @@ -320,6 +320,7 @@ XINIT "$client" $clientargs -- "$server" $display $serverargs
>  #endif
>
>  #endif
> +retval=$?
>
>  if [ x"$enable_xauth" = x1 ] ; then
>     if [ x"$removelist" != x ]; then
> @@ -347,3 +348,6 @@ screenrestore
>  #if defined(sun)
>  kbd_mode -a
>  #endif
> +
> +exit $retval
> +

Sorry for not replying earlier. I think this makes sense, but it seems
that you'd also want to know if xauth (or other commands) failed, too.
Without making the script a lot more complicated, I guess this is the
right thing to do. If no one has any objections, I'll push this.

--
Dan



More information about the xorg mailing list