Просмотр исходного кода

main: use syslog & printf directly for early log messages

libqb seems funny about logging things before its fully configured.
This corosync commit didn't help either:
8b6bd86a55b8bda9f3a8ff67bdff908263976fa3

So to make sure that messages about the config file not being opened
get delivered to the user/syslog we send them directly.

(backported from master 01495f650cd02f2cc10c27be83ad933baa2ead01)

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 8 лет назад
Родитель
Сommit
1dee027d69
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      exec/main.c

+ 6 - 1
exec/main.c

@@ -1321,7 +1321,12 @@ int main (int argc, char **argv, char **envp)
 
 
 	res = coroparse_configparse(icmap_get_global_map(), &error_string);
 	res = coroparse_configparse(icmap_get_global_map(), &error_string);
 	if (res == -1) {
 	if (res == -1) {
-		log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
+		/*
+		 * Logsys can't log properly at this early stage, and we need to get this message out
+		 *
+		 */
+		fprintf (stderr, "%s\n", error_string);
+		syslog (LOGSYS_LEVEL_ERROR, "%s", error_string);
 		corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
 		corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
 	}
 	}