loader: unconditionally include unistd.h and stdlib.h
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 7 Feb 2017 07:43:09 +0000 (08:43 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 10 Feb 2017 11:47:12 +0000 (11:47 +0000)
Otherwise we would fail with "implicit declaration of function" geteuid
and getenv respectively.

To trigger (re)move the libdrm.pc file and use the following:

 $ ./autogen.sh --disable-egl --disable-gbm --disable-dri \
    --with-dri-drivers=swrast --with-gallium-drivers=swrast
 $ make

Cc: Vinson Lee <vlee@freedesktop.org>
Fixes: 3f462050c ("loader: Add an environment variable to override driver name choice.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99701
v2: [Emil: handle stdlib.h add commit message]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
src/loader/loader.c

index 4825151ad5e55c80c3d01c7eebe0b5674708c299..3b28a0e7db7a4c26f5cdb9fb1706f2bbd7a27439 100644 (file)
@@ -33,6 +33,8 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
 #ifdef MAJOR_IN_MKDEV
 #include <sys/mkdev.h>
 #endif
@@ -42,8 +44,6 @@
 #include "loader.h"
 
 #ifdef HAVE_LIBDRM
-#include <stdlib.h>
-#include <unistd.h>
 #include <xf86drm.h>
 #ifdef USE_DRICONF
 #include "xmlconfig.h"