util: added missing headers in anon-file
authorGurchetan Singh <gurchetansingh@chromium.org>
Thu, 8 Aug 2019 16:42:07 +0000 (09:42 -0700)
committerGurchetan Singh <gurchetansingh@chromium.org>
Thu, 8 Aug 2019 23:21:57 +0000 (16:21 -0700)
Otherwise I get:

../src/util/anon_file.c: In function ‘create_tmpfile_cloexec’:
../src/util/anon_file.c:75:9: error: implicit declaration of function ‘mkostemp’
[-Werror=implicit-function-declaration]
    fd = mkostemp(tmpname, O_CLOEXEC);
         ^~~~~~~~

../src/util/anon_file.c:133:7: error: implicit declaration of function ‘asprintf’
[-Werror=implicit-function-declaration]
       asprintf(&name, "%s/mesa-shared-%s-XXXXXX", path, debug_name);
       ^~~~~~~~
../src/util/anon_file.c:141:4: error: implicit declaration of function ‘free’
[-Werror=implicit-function-declaration]
    free(name)

Fixes: c0376a ("util: add anon_file.h for all memfd/temp file usage")
src/util/anon_file.c

index 2780c74a680b12e9f0d913e5baf411b93d8fef68..90c55cd5af0c8a7347ffbddeaa718ae8a96f4738 100644 (file)
@@ -33,6 +33,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 #ifdef __FreeBSD__
 #include <sys/mman.h>