Changeset 1500:789ffe085574 in roaraudio


Ignore:
Timestamp:
03/31/09 20:53:38 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

test for ROAR_HAVE_IO_POSIX and ROAR_HAVE_FORK, only close listening socket if we have ROAR_SUPPORT_LISTEN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/lib.c

    r1197 r1500  
    2626 
    2727int lib_run_bg(char * cmd, int infh, int outfh, int errfh, int * closefh, int lenclose) { 
     28#ifdef ROAR_HAVE_FORK 
    2829 pid_t child = fork(); 
    2930 int fh[3] = {-1, -1, -1}; 
     
    5051 // TODO: test for errors here. 
    5152 
     53#ifdef ROAR_SUPPORT_LISTEN 
    5254 close(g_listen_socket); // listen socket. 
     55#endif 
    5356 
    5457// this breaks the new driver interface 
     
    5861 
    5962 // close fh's we got ask to close: 
     63#ifdef ROAR_HAVE_IO_POSIX 
    6064 for (i = 0; i < lenclose; i++) 
    6165  close(closefh[i]); 
     66#else 
     67 if ( lenclose ) { 
     68  ROAR_WARN("lib_run_bg(*): lenclose > 0 and no way known to close fds"); 
     69 } 
     70#endif 
    6271 
    6372 // next we need to remap our stdio: 
     
    6574 
    6675 for (i = 0; i < 3; i++) { 
     76#ifdef ROAR_HAVE_IO_POSIX 
    6777  close(i); 
     78#endif 
    6879  dup2(fh[i], i); // todo test if this is ok. 
    6980  close(fh[i]); 
     
    7687 // still alive? BAD! 
    7788 ROAR_ERR("lib_run_bg(*): We are still alive! BAD!"); 
    78  _exit(3); 
     89 ROAR_U_EXIT(3); 
    7990 return -1; 
     91#else 
     92 return -1; 
     93#endif 
    8094} 
    8195 
Note: See TracChangeset for help on using the changeset viewer.