Browse Source

logsys: Log error if blackbox cannot be created

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 11 years ago
parent
commit
19c5b63ff5
1 changed files with 4 additions and 2 deletions
  1. 4 2
      exec/main.c

+ 4 - 2
exec/main.c

@@ -196,6 +196,7 @@ static void corosync_blackbox_write_to_file (void)
 	char time_str[PATH_MAX];
 	char time_str[PATH_MAX];
 	struct tm cur_time_tm;
 	struct tm cur_time_tm;
 	time_t cur_time_t;
 	time_t cur_time_t;
+	ssize_t res;
 
 
 	cur_time_t = time(NULL);
 	cur_time_t = time(NULL);
 	localtime_r(&cur_time_t, &cur_time_tm);
 	localtime_r(&cur_time_t, &cur_time_tm);
@@ -206,8 +207,9 @@ static void corosync_blackbox_write_to_file (void)
 	    time_str,
 	    time_str,
 	    (long long int)getpid());
 	    (long long int)getpid());
 
 
-	qb_log_blackbox_write_to_file(fname);
-
+	if ((res = qb_log_blackbox_write_to_file(fname)) < 0) {
+		LOGSYS_PERROR(-res, LOGSYS_LEVEL_ERROR, "Can't store blackbox file");
+	}
 	unlink(LOCALSTATEDIR "/lib/corosync/fdata");
 	unlink(LOCALSTATEDIR "/lib/corosync/fdata");
 	if (symlink(fname, LOCALSTATEDIR "/lib/corosync/fdata") == -1) {
 	if (symlink(fname, LOCALSTATEDIR "/lib/corosync/fdata") == -1) {
 		log_printf(LOGSYS_LEVEL_ERROR, "Can't create symlink to '%s' for corosync blackbox file '%s'",
 		log_printf(LOGSYS_LEVEL_ERROR, "Can't create symlink to '%s' for corosync blackbox file '%s'",