diff options
Diffstat (limited to 'Source/kwsys/ProcessUNIX.c')
-rw-r--r-- | Source/kwsys/ProcessUNIX.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index a8a15dd..19bf982 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -41,6 +41,12 @@ do. /* Increase the file descriptor limit for select() before including related system headers. (Default: 64) */ # define FD_SETSIZE 16384 +#elif defined(__APPLE__) +/* Increase the file descriptor limit for select() before including + related system headers. (Default: 1024) */ +# define _DARWIN_UNLIMITED_SELECT +# include <limits.h> /* OPEN_MAX */ +# define FD_SETSIZE OPEN_MAX #endif #include <assert.h> /* assert */ @@ -2287,7 +2293,8 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig, #endif default: cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_Other; - sprintf(cp->ProcessResults[idx].ExitExceptionString, "Signal %d", sig); + snprintf(cp->ProcessResults[idx].ExitExceptionString, + KWSYSPE_PIPE_BUFFER_SIZE + 1, "Signal %d", sig); break; } } @@ -2540,7 +2547,7 @@ static void kwsysProcessKill(pid_t process_id) int pid; if (sscanf(d->d_name, "%d", &pid) == 1 && pid != 0) { struct stat finfo; - sprintf(fname, "/proc/%d/stat", pid); + snprintf(fname, sizeof(fname), "/proc/%d/stat", pid); if (stat(fname, &finfo) == 0) { FILE* f = fopen(fname, "r"); if (f) { |