mirror of
https://github.com/Interlisp/maiko.git
synced 2026-05-05 07:44:20 +00:00
Remove getdtablesize calls in favor of sysconf(_SC_OPEN_MAX). (#45)
`getdtablesize()` has long been deprecated in favor of `sysconf(_SC_OPEN_MAX)`.
This commit is contained in:
@@ -277,11 +277,7 @@ int FindUnixPipes(void) {
|
|||||||
if ((envtmp = getenv("LDEUNIXPID"))) UnixPID = atoi(envtmp);
|
if ((envtmp = getenv("LDEUNIXPID"))) UnixPID = atoi(envtmp);
|
||||||
|
|
||||||
/* This is a good place to initialize stuff like the UJ table */
|
/* This is a good place to initialize stuff like the UJ table */
|
||||||
#ifdef SYSVONLY
|
|
||||||
NPROCS = sysconf(_SC_OPEN_MAX);
|
NPROCS = sysconf(_SC_OPEN_MAX);
|
||||||
#else
|
|
||||||
NPROCS = getdtablesize();
|
|
||||||
#endif /* SYSVONLY */
|
|
||||||
|
|
||||||
UJ = (struct unixjob *)malloc(NPROCS * sizeof(struct unixjob));
|
UJ = (struct unixjob *)malloc(NPROCS * sizeof(struct unixjob));
|
||||||
cleareduj.status = -1;
|
cleareduj.status = -1;
|
||||||
|
|||||||
@@ -446,13 +446,8 @@ int fork_Unix() {
|
|||||||
dup2(sock, 1);
|
dup2(sock, 1);
|
||||||
dup2(sock, 2);
|
dup2(sock, 2);
|
||||||
|
|
||||||
#ifdef SYSVONLY
|
/* Make sure everything else is closed. */
|
||||||
/* Make sure everything else is closed POSIX has no getdtab... */
|
|
||||||
for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) close(i);
|
for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) close(i);
|
||||||
#else
|
|
||||||
/* Make sure everything else is closed */
|
|
||||||
for (i = 3; i < getdtablesize(); i++) close(i);
|
|
||||||
#endif /* SYSVONLY */
|
|
||||||
|
|
||||||
/* Run the shell command and get the result */
|
/* Run the shell command and get the result */
|
||||||
status = system(cmdstring);
|
status = system(cmdstring);
|
||||||
|
|||||||
Reference in New Issue
Block a user