From 8a0a2dbbe24dae6de589df05b7662117af74f10f Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 11 Oct 2005 00:18:42 +0000
Subject: [PATCH] Remove logic to disable localtime_r() after a fork(), it is
 no longer  needed thanks to slurmd_step functionality.

---
 src/common/macros.h     | 11 -----------
 src/common/slurm_cred.c |  2 +-
 src/slurmd/req.c        |  4 ----
 3 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/common/macros.h b/src/common/macros.h
index ada19676f57..35c4d2d3821 100644
--- a/src/common/macros.h
+++ b/src/common/macros.h
@@ -236,15 +236,4 @@ typedef enum {false, true} bool;
 #  endif
 #endif
 
-/* localtime() can't be used after a fork due to possibly set semaphore.
- * until we modify slurmd and srun to exec immediately after the fork, 
- * we disable localtime(). This is a temporary patch. */
-#define DISABLE_LOCALTIME 1
-#include "src/common/xstring.h"
-#include "src/common/slurm_cred.h"
-#define disable_localtime()						\
-	_STMT_START {							\
-		_xstrftimecat(NULL, NULL);				\
-		timestr(NULL,NULL,0);					\
-	} _STMT_END
 #endif /* !_MACROS_H */
diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c
index b84bfca532c..965301bb615 100644
--- a/src/common/slurm_cred.c
+++ b/src/common/slurm_cred.c
@@ -1118,7 +1118,7 @@ static char * timestr (const time_t *tp, char *buf, size_t n)
 	if (disabled) return NULL;
 #endif
 	if (!localtime_r (tp, &tmval))
-		error ("localtime: %m");
+		error ("localtime_r: %m");
 	strftime (buf, n, fmt, &tmval);
 	return (buf);
 }
diff --git a/src/slurmd/req.c b/src/slurmd/req.c
index 89a8fdfc4b4..cee5f1ce89d 100644
--- a/src/slurmd/req.c
+++ b/src/slurmd/req.c
@@ -357,10 +357,6 @@ _fork_new_slurmd(slurmd_step_type_t type, void *req,
 		return ((int) pid);
 	}
 
-#ifdef DISABLE_LOCALTIME
-	disable_localtime();
-#endif
-	
 	if (setsid() < 0)
 		error("fork_slurmd: setsid: %m");
 	
-- 
GitLab