diff --git a/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c b/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c
index 7c328d7fe00c2225c25f82fc3bba028977e25ef8..7927956fdc108942a61e0120cd5c37f3f524767a 100644
--- a/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c
+++ b/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c
@@ -1286,10 +1286,12 @@ extern int filetxt_jobacct_process_archive(slurmdb_archive_cond_t *arch_cond)
 	}
 
 	if (new_file) {  /* By default, the expired file looks like the log */
-		chmod(logfile_name, prot);
-		if (chown(logfile_name, uid, gid) == -1)
-			error("Couldn't change ownership of %s to %u:%u",
-			      logfile_name, uid, gid);
+		if (chmod(logfile_name, prot) == -1)
+			error("%s: chmod(%s): %m", __func__, logfile_name);
+		if (chown(logfile_name, uid, gid) == -1) {
+			error("%s(1): chown(%s, %u, %u)",
+			      __func__, logfile_name, uid, gid);
+		}
 	}
 	xfree(logfile_name);
 
@@ -1301,12 +1303,16 @@ extern int filetxt_jobacct_process_archive(slurmdb_archive_cond_t *arch_cond)
 		fclose(expired_logfile);
 		goto finished;
 	}
-	chmod(logfile_name, prot);     /* preserve file protection */
-	if (chown(logfile_name, uid, gid) == -1)/* and ownership */
-		error("2 Couldn't change ownership of %s to %u:%u",
-		      logfile_name, uid, gid);
-	/* Use line buffering to allow us to safely write
-	 * to the log file at the same time as slurmctld. */
+	if (chmod(logfile_name, prot) == -1)
+		error("%s(2): chmod(%s): %m", __func__, logfile_name);
+	if (chown(logfile_name, uid, gid) == -1) {
+		error("%s(2): chown(%s, %u, %u)",
+		      __func__, logfile_name, uid, gid);
+	}
+	/*
+	 * Use line buffering to allow us to safely write
+	 * to the log file at the same time as slurmctld.
+	 */
 	if (setvbuf(new_logfile, NULL, _IOLBF, 0)) {
 		perror("setvbuf()");
 		fclose(expired_logfile);