Merge in mingw changes.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3873 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-05-16 22:30:14 +00:00
parent 87224d2bb6
commit 7848b5e560
12 changed files with 188 additions and 50 deletions

View File

@ -14,7 +14,7 @@
#include <string.h>
#if !defined (_WIN32) && !defined (__MACH__)
#if !defined(_WIN32) && !defined(__MACH__)
#include <signal.h>
#include <sys/prctl.h>
#include <sys/resource.h>
@ -80,7 +80,7 @@ const command_t k_commands[] = {
void shedPrivileges()
{
#if !defined (_WIN32)
#if !defined(_WIN32)
struct rlimit zeroLimit;
zeroLimit.rlim_cur = 0;
zeroLimit.rlim_max = 0;
@ -111,7 +111,7 @@ void shedPrivileges()
perror("setrlimit(RLIMIT_NPROC, {0, 0})");
exit(-1);
}
#if !defined (__MACH__)
#if !defined(__MACH__)
if (setrlimit(RLIMIT_LOCKS, &zeroLimit) != 0)
{
perror("setrlimit(RLIMIT_LOCKS, {0, 0})");
@ -288,7 +288,7 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
"/~cory/docs",
"/~cory/ssb",
};
for (int i = 0; i < _countof(k_export); i++)
for (int i = 0; i < (int)_countof(k_export); i++)
{
printf("Exporting %s...\n", k_export[i]);
tf_ssb_export(ssb, k_export[i]);
@ -417,7 +417,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[])
}
int result = 0;
#if !defined (_WIN32) && !defined (__MACH__)
#if !defined(_WIN32) && !defined(__MACH__)
setpgid(0, 0);
#endif
@ -612,7 +612,7 @@ static int _tf_command_usage(const char* file, int argc, char* argv[])
{
printf("Usage: %s command [command-options]\n", file);
printf("commands:\n");
for (int i = 0; i < _countof(k_commands); i++)
for (int i = 0; i < (int)_countof(k_commands); i++)
{
printf(" %s - %s\n", k_commands[i].name, k_commands[i].description);
}
@ -621,11 +621,13 @@ static int _tf_command_usage(const char* file, int argc, char* argv[])
int main(int argc, char* argv[])
{
#if !defined(_WIN32)
prctl(PR_SET_PDEATHSIG, SIGKILL);
#endif
uv_setup_args(argc, argv);
tf_taskstub_startup();
#if !defined (_WIN32)
#if !defined(_WIN32)
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
{
perror("signal");
@ -634,7 +636,7 @@ int main(int argc, char* argv[])
if (argc >= 2)
{
for (int i = 0; i < _countof(k_commands); i++)
for (int i = 0; i < (int)_countof(k_commands); i++)
{
const command_t* command = &k_commands[i];
if (strcmp(argv[1], command->name) == 0)