예제 #1
0
/** Set a file's access and modify time to u.udeathday. */
static void
adjust_file_timestamp(const char *fpath)
{
# ifdef HAVE_UTIME_H
    if (u.udeathday > 0) {
        struct utimbuf tv;
        tv.actime = u.udeathday;
        tv.modtime = u.udeathday;
        if (utime(fpath, &tv)) {
            paniclog("adjust_file_timestamp: utime failed: ", strerror(errno));
        }
    }
# endif
}
예제 #2
0
파일: end.c 프로젝트: FredrIQ/fiqhack
/*VARARGS1*/
noreturn void
panic_core(const char *file, int line, const char *str, ...)
{
    va_list the_args;
    const char *buf;

    nonfatal_dump_core();

    va_start(the_args, str);

    if (program_state.panicking++)
        terminate(GAME_DETACHED); /* avoid loops - this should never happen */

    buf = msgvprintf(str, the_args, TRUE);
    paniclog("panic", buf);
    DEBUG_LOG_BACKTRACE("panic() called: %s\n", buf);

    log_recover_noreturn(get_log_start_of_turn_offset(), buf, file, line);
}
예제 #3
0
/*VARARGS1*/
void
impossible_core(const char *file, int line, const char *s, ...)
{
    nonfatal_dump_core();

    va_list args;
    const char *pbuf;

    va_start(args, s);
    if (program_state.in_impossible)
        panic("impossible called impossible");
    program_state.in_impossible = 1;
    
    pbuf = msgvprintf(s, args, TRUE);
    paniclog("impossible", pbuf);
    DEBUG_LOG_BACKTRACE("impossible() called: %s\n", pbuf);

    va_end(args);
    program_state.in_impossible = 0;

    log_recover_core(get_log_start_of_turn_offset(), TRUE, pbuf, file, line);
}
예제 #4
0
파일: windows.c 프로젝트: DanielT/NitroHack
/*
 *   Parameter validator for generic yes/no function to prevent
 *   the core from sending too long a prompt string to the
 *   window port causing a buffer overflow there.
 */
char yn_function(const char *query,const char *resp, char def)
{
	char qbuf[QBUFSZ], key;
	unsigned truncspot, reduction = sizeof(" [N]  ?") + 1;

	if (resp)
	    reduction += strlen(resp) + sizeof(" () ");
	
	if (strlen(query) >= (QBUFSZ - reduction)) {
	    paniclog("Query truncated: ", query);
	    reduction += sizeof("...");
	    truncspot = QBUFSZ - reduction;
	    strncpy(qbuf, query, (int)truncspot);
	    qbuf[truncspot] = '\0';
	    strcat(qbuf,"...");
	} else
	    strcpy(qbuf, query);
	
	key = (*windowprocs.win_yn_function)(qbuf, resp, def);
	log_yn_function(key);
	return key;
}