2021-01-27 16:13:06 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2021-01-27 21:26:19 +00:00
|
|
|
#include <libreborn/libreborn.h>
|
2021-01-27 16:13:06 +00:00
|
|
|
|
2021-06-17 21:32:24 +00:00
|
|
|
#include "../home/home.h"
|
2021-01-27 16:13:06 +00:00
|
|
|
#include "../init/init.h"
|
|
|
|
|
|
|
|
void run_tests() {
|
2021-02-10 20:47:38 +00:00
|
|
|
// Test ~/.minecraft-pi Permissions
|
2021-01-31 02:32:20 +00:00
|
|
|
{
|
2021-06-17 21:32:24 +00:00
|
|
|
char *path = home_get();
|
|
|
|
int exists = access(path, F_OK) == 0;
|
|
|
|
int can_write = exists ? access(path, R_OK | W_OK) == 0 : 1;
|
2021-01-31 02:32:20 +00:00
|
|
|
|
2021-06-17 21:32:24 +00:00
|
|
|
if (!can_write) {
|
2021-01-27 16:13:06 +00:00
|
|
|
// Failure
|
2021-06-17 21:32:24 +00:00
|
|
|
ERR("%s", "Invalid Data Directory Permissions");
|
2021-01-27 16:13:06 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-17 21:32:24 +00:00
|
|
|
}
|