From eda1a44636cbb598ac4eacf276bf3b52dfd6fce3 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 21 Nov 2003 18:21:05 +0000
Subject: [PATCH] Save updated job completion log file name, even if open
 fails.

---
 src/plugins/jobcomp/jobcomp_filetxt.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/plugins/jobcomp/jobcomp_filetxt.c b/src/plugins/jobcomp/jobcomp_filetxt.c
index e5f91f9c14f..8b68e9c8d95 100644
--- a/src/plugins/jobcomp/jobcomp_filetxt.c
+++ b/src/plugins/jobcomp/jobcomp_filetxt.c
@@ -109,6 +109,8 @@ int slurm_jobcomp_set_location ( char * location )
 		plugin_errno = EACCES;
 		return SLURM_ERROR;
 	}
+	xfree(log_name);
+	log_name = xstrdup(location);
 
 	slurm_mutex_lock( &file_lock );
 	if (job_comp_fd >= 0)
@@ -118,11 +120,8 @@ int slurm_jobcomp_set_location ( char * location )
 		error("open %s: %m", location);
 		plugin_errno = errno;
 		rc = SLURM_ERROR;
-	} else {
+	} else
 		fchmod(job_comp_fd, 0644);
-		xfree(log_name);
-		log_name = xstrdup(location);
-	}
 	slurm_mutex_unlock( &file_lock );
 	return rc;
 }
-- 
GitLab