470c5c8fc13a81b0424a46ed3f4686ca8a703a0f hiram Wed Nov 16 15:43:37 2022 -0800 fix error in sysconf return on Mac OSX M1/arm64 machine refs #29651 diff --git src/lib/pipeline.c src/lib/pipeline.c index de8e40a..5060dd7 100644 --- src/lib/pipeline.c +++ src/lib/pipeline.c @@ -74,30 +74,33 @@ int fd = *fdPtr; if (fd != -1) { if (close(fd) < 0) errnoAbort("close failed on fd %d", fd); *fdPtr = -1; } } static void closeNonStdDescriptors(void) /* close non-standard file descriptors */ { long maxFd = sysconf(_SC_OPEN_MAX); if (maxFd < 0) maxFd = 4096; // shouldn't really happen +if (maxFd > 4096) // this does happen on Mac OSX arm64/M1 machine + maxFd = 4096; // under some condition in the browser while making + // custom tracks. It returns: 2^63 - 1 int fd; for (fd = STDERR_FILENO+1; fd < maxFd; fd++) close(fd); } static char* joinCmd(char **cmd) /* join an cmd vector into a space separated string */ { struct dyString *str = dyStringNew(512); int i; for (i = 0; cmd[i] != NULL; i++) { if (i > 0) dyStringAppend(str, " "); dyStringAppend(str, cmd[i]); @@ -405,31 +408,32 @@ while (pl->numRunning > 0) waitOnOne(pl); } /* uses to stash pipeline object for group leader process only, which is * single-threaded */ static struct pipeline* groupApoptosisPipeline = NULL; static void groupApoptosis(int signum) /* signal handler for SIGALRM expiration */ { // hopefully this gets logged or seen by user fprintf(stderr, "pipeline timeout kill after %d seconds: %s\n", groupApoptosisPipeline->timeout, pipelineDesc(groupApoptosisPipeline)); fflush(stderr); -(int)kill(0, SIGKILL); // kill off process group +// the (void) tells the compiler we know we are ignoring the return value +(void)kill(0, SIGKILL); // kill off process group } static void setupTimeout(struct pipeline* pl) /* setup timeout handling */ { groupApoptosisPipeline = pl; if (signal(SIGALRM, groupApoptosis) == SIG_ERR) errnoAbort("signal failed"); (void)alarm(pl->timeout); } static void groupLeaderRun(struct pipeline* pl, int stdinFd, int stdoutFd, int stderrFd, void *otherEndBuf, size_t otherEndBufSize) /* group leader process */ {