forked from aniani/nasm
nasmlib: Do not hang on if log file creation has been failed
In case if we can't open "malloc.log" for writing we should not hang out but rather switch to stderr and continue processing. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2010 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -90,7 +90,12 @@ void nasm_init_malloc_error(void)
|
|||||||
{
|
{
|
||||||
#ifdef LOGALLOC
|
#ifdef LOGALLOC
|
||||||
logfp = fopen("malloc.log", "w");
|
logfp = fopen("malloc.log", "w");
|
||||||
|
if (logfp) {
|
||||||
setvbuf(logfp, NULL, _IOLBF, BUFSIZ);
|
setvbuf(logfp, NULL, _IOLBF, BUFSIZ);
|
||||||
|
} else {
|
||||||
|
nasm_error(ERR_NONFATAL | ERR_NOFILE, "Unable to open %s", file);
|
||||||
|
logfp = stderr;
|
||||||
|
}
|
||||||
fprintf(logfp, "null pointer is %p\n", NULL);
|
fprintf(logfp, "null pointer is %p\n", NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user