Browse Source

Bugfix: Use atexit() to ensure a final \n is always printed at exit to work cleanly with new logging design

Luke Dashjr 11 years ago
parent
commit
accf46768f
2 changed files with 8 additions and 1 deletions
  1. 0 1
      logging.h
  2. 8 0
      miner.c

+ 0 - 1
logging.h

@@ -133,7 +133,6 @@ extern void _bfg_clean_up(bool);
 	if (fmt) { \
 		fprintf(stderr, "\n" fmt, ##__VA_ARGS__);  \
 	} \
-	fprintf(stderr, "\n");  \
 	fflush(stderr);  \
 	_quit(status); \
 } while (0)

+ 8 - 0
miner.c

@@ -12038,6 +12038,12 @@ static void raise_fd_limits(void)
 #endif
 }
 
+static
+void bfg_atexit(void)
+{
+	puts("");
+}
+
 extern void bfg_init_threadlocal();
 extern void stratumsrv_start();
 
@@ -12054,6 +12060,8 @@ int main(int argc, char *argv[])
 #ifdef WIN32
 	LoadLibrary("backtrace.dll");
 #endif
+	
+	atexit(bfg_atexit);
 
 	blkmk_sha256_impl = my_blkmaker_sha256_callback;