2021-01-27 11:13:06 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2021-01-27 16:26:19 -05:00
|
|
|
#include <libreborn/libreborn.h>
|
2021-01-27 11:13:06 -05:00
|
|
|
|
2021-06-17 17:32:24 -04:00
|
|
|
#include "../home/home.h"
|
2021-01-27 11:13:06 -05:00
|
|
|
#include "../init/init.h"
|
|
|
|
|
|
|
|
void run_tests() {
|
2021-02-10 15:47:38 -05:00
|
|
|
// Test ~/.minecraft-pi Permissions
|
2021-01-30 21:32:20 -05:00
|
|
|
{
|
2021-06-17 17:32:24 -04: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-30 21:32:20 -05:00
|
|
|
|
2021-06-17 17:32:24 -04:00
|
|
|
if (!can_write) {
|
2021-01-27 11:13:06 -05:00
|
|
|
// Failure
|
2021-06-17 17:32:24 -04:00
|
|
|
ERR("%s", "Invalid Data Directory Permissions");
|
2021-01-27 11:13:06 -05:00
|
|
|
}
|
|
|
|
}
|
2021-06-17 17:32:24 -04:00
|
|
|
}
|