Xephyr: Don't crash when no command line argument is specified

The DDX specific command line parsing function only gets called
if command line arguments are present. Therefore this function
is not suitable to initialize mandatory global variables.
Replace main() instead.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Egbert Eich 2015-03-31 09:14:25 +02:00 committed by Keith Packard
parent 00f79416b1
commit 5af73f4908
4 changed files with 12 additions and 5 deletions

View File

@ -2404,7 +2404,8 @@ if test "$KDRIVE" = yes; then
fi
;;
esac
KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB"
KDRIVE_MAIN_LIB="$MAIN_LIB"
KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
@ -2416,6 +2417,7 @@ AC_SUBST([KDRIVE_INCS])
AC_SUBST([KDRIVE_PURE_INCS])
AC_SUBST([KDRIVE_CFLAGS])
AC_SUBST([KDRIVE_PURE_LIBS])
AC_SUBST([KDRIVE_MAIN_LIB])
AC_SUBST([KDRIVE_LOCAL_LIBS])
AC_SUBST([KDRIVE_LIBS])
AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])

View File

@ -52,6 +52,13 @@ void processScreenOrOutputArg(const char *screen_size, const char *output, char
void processOutputArg(const char *output, char *parent_id);
void processScreenArg(const char *screen_size, char *parent_id);
int
main(int argc, char *argv[], char *envp[])
{
hostx_use_resname(basename(argv[0]), 0);
return dix_main(argc, argv, envp);
}
void
InitCard(char *name)
{
@ -209,10 +216,6 @@ ddxProcessArgument(int argc, char **argv, int i)
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]);
if (i == 1) {
hostx_use_resname(basename(argv[0]), 0);
}
if (!strcmp(argv[i], "-parent")) {
if (i + 1 < argc) {
int j;

View File

@ -18,6 +18,7 @@ Xfake_SOURCES = \
Xfake_LDADD = \
libfake.la \
@KDRIVE_MAIN_LIB@ \
@KDRIVE_LIBS@
Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)

View File

@ -16,6 +16,7 @@ Xfbdev_SOURCES = \
Xfbdev_LDADD = \
libfbdev.la \
@KDRIVE_MAIN_LIB@ \
@KDRIVE_LIBS@
Xfbdev_DEPENDENCIES = \