int open_logfile( int *log_fd, struct task_details *plan) { int rc = RC_NORMAL, sysrc, errlen; mode_t mode, save_umask; save_umask = umask( 0); mode = convert_to_mode( plan->logmode); if( plan->debug >= DEBUG_MEDIUM) fprintf( stderr, "Flags for open %x\n", plan->openflags); sysrc = open( plan->logfile, plan->openflags, mode); if( sysrc > 0) *log_fd = sysrc; else { sysrc = errno; rc = ERR_OPEN_FAILED; errlen = strlen( ERRMSG_OPEN_FAILED) + strlen( plan->logfile) + INT_ERR_DISPLAY_LEN; plan->err_msg = (char *) malloc( errlen); if( !plan->err_msg) rc = ERR_MALLOC_FAILED; else snprintf( plan->err_msg, errlen, ERRMSG_OPEN_FAILED, plan->logfile, sysrc); } if( plan->debug >= DEBUG_LOW) fprintf( stderr, "Opened log file '%s', mode=%x (%d), flags (%x), fd=%d, err=%d\n", plan->logfile, mode, plan->logmode, plan->openflags, sysrc, errno); (void) umask( save_umask); return( rc); }
static inline rtx emit_partition_copy (rtx dest, rtx src, int unsignedsrcp, tree sizeexp) { rtx seq; start_sequence (); if (GET_MODE (src) != VOIDmode && GET_MODE (src) != GET_MODE (dest)) src = convert_to_mode (GET_MODE (dest), src, unsignedsrcp); if (GET_MODE (src) == BLKmode) { gcc_assert (GET_MODE (dest) == BLKmode); emit_block_move (dest, src, expr_size (sizeexp), BLOCK_OP_NORMAL); } else emit_move_insn (dest, src); seq = get_insns (); end_sequence (); return seq; }