Changeset 947


Ignore:
Timestamp:
Jan 11, 2004, 5:51:02 PM (22 years ago)
Author:
bird
Message:

do close on exec stuff (paranoia and such).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/binutils/libiberty/pex-os2.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r946 r947  
    4747#define INCL_BASE
    4848#include <os2.h>
     49#include <sys/fcntl.h>
    4950
    5051int
     
    9394      output_desc = pdes[WRITE_PORT];
    9495      last_pipe_input = pdes[READ_PORT];
     96      /* we don't wanna have an extra handles in the child. */
     97      fcntl (pdes[READ_PORT], F_SETFD, FD_CLOEXEC);
     98      fcntl (pdes[WRITE_PORT], F_SETFD, FD_CLOEXEC);
    9599    }
    96100  else
     
    99103    {
    100104      org_stdin = dup (STDIN_FILE_NO);
     105      fcntl (org_stdin, F_SETFD, FD_CLOEXEC);
    101106      dup2 (input_desc, STDIN_FILE_NO);
     107      fcntl (STDIN_FILE_NO, F_SETFD, 0); /* paranoia. but what's the deal with this flag over dup? */
    102108      close (input_desc);
    103109    }
     
    105111    {
    106112      org_stdout = dup (STDOUT_FILE_NO);
     113      fcntl (org_stdout, F_SETFD, FD_CLOEXEC);
    107114      dup2 (output_desc, STDOUT_FILE_NO);
     115      fcntl (STDOUT_FILE_NO, F_SETFD, 0); /* paranoia. but what's the deal with this flag over dup? */
    108116      close (output_desc);
    109117    }
     118
    110119  pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_NOWAIT, program, argv);
     120
    111121  if (pipes_supported && input_desc != STDIN_FILE_NO)
    112122    {
    113123      dup2 (org_stdin, STDIN_FILE_NO);
     124      fcntl (STDIN_FILE_NO, F_SETFD, 0); /* paranoia. but what's the deal with this flag over dup? */
    114125      close (org_stdin);
    115126    }
     
    117128    {
    118129      dup2 (org_stdout, STDOUT_FILE_NO);
     130      fcntl (STDOUT_FILE_NO, F_SETFD, 0); /* paranoia. but what's the deal with this flag over dup? */
    119131      close (org_stdout);
    120132    }
Note: See TracChangeset for help on using the changeset viewer.