Fixed errors & warnings when compiling on linux

I added header files with #include to prevent the implicit declaration warnings and fixed a typo in function size_t lovrPlatformGetExecutablePath(char* buffer, size_t size).
This commit is contained in:
Elias Fleckenstein 2020-07-10 16:32:45 +02:00 committed by GitHub
parent 6eab6d2a40
commit ea9fadc1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,10 @@
#include "os.h"
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <pwd.h>
#include "os_glfw.h"
@ -97,7 +101,7 @@ size_t lovrPlatformGetWorkingDirectory(char* buffer, size_t size) {
}
size_t lovrPlatformGetExecutablePath(char* buffer, size_t size) {
ssize_t length = readlink("/proc/self/exe", buffer, size - 1);
size_t length = readlink("/proc/self/exe", buffer, size - 1);
if (length >= 0) {
buffer[length] = '\0';
return length;