pike.git / src / modules / _Stdio / file.c

version» Context lines:

pike.git/src/modules/_Stdio/file.c:2458:    return 0; /* Make CC happy */    }   }      /*! @decl string grantpt()    *!    *! If this file has been created by calling @[openpt()], return the    *! filename of the associated pts-file. This function should only be    *! called once.    *! +  *! @returns +  *! Returns the filename of the corresponding pts. +  *!    *! @note    *! This function is only available on some platforms.    */   #if defined(HAVE_GRANTPT) || defined(USE_PT_CHMOD) || defined(USE_CHGPT)   static void file_grantpt( INT32 args )   {    pop_n_elems(args);   #if defined(USE_PT_CHMOD) || defined(USE_CHGPT)    push_constant_text("Process.Process");    APPLY_MASTER("resolv", 1);
pike.git/src/modules/_Stdio/file.c:2505: Inside #if defined(HAVE_GRANTPT) || defined(USE_PT_CHMOD) || defined(USE_CHGPT) and #if defined(USE_PT_CHMOD)
   Pike_error(   #ifdef USE_PT_CHMOD    USE_PT_CHMOD   #else /* USE_CHGPT */    USE_CHGPT   #endif /* USE_PT_CHMOD */    " returned error %d.\n", Pike_sp[-1].u.integer);    }    pop_n_elems(3);   #else /* HAVE_GRANTPT */ +  /* Make sure the fd doesn't get closed when it gets sent +  * to the subprocess (aka /usr/lib/pt_chmod). +  */ +  set_close_on_exec(FD, 0);    if( grantpt( FD ) )    Pike_error("grantpt failed: %s\n", strerror(errno)); -  +  set_close_on_exec(FD, 1);   #endif /* USE_PT_CHMOD || USE_CHGPT */    push_text( ptsname( FD ) );   #ifdef HAVE_UNLOCKPT    if( unlockpt( FD ) )    Pike_error("unlockpt failed: %s\n", strerror(errno));   #endif   }   #endif /* HAVE_GRANTPT || USE_PT_CHMOD || USE_CHGPT */      /*! @decl int close()