[Pkg-wmaker-commits] [wmsun] 33/73: wmgeneral, wmsun: Use threadsafe functions.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Aug 28 12:04:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmsun.

commit 436b6a34be3f4dad88dc5a63ad3a6873d5fa01a6
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Sun Jun 14 17:04:48 2015 -0500

    wmgeneral, wmsun: Use threadsafe functions.
---
 wmSun.c               | 8 ++++++--
 wmgeneral/wmgeneral.c | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/wmSun.c b/wmSun.c
index f3fc778..a0ad31b 100644
--- a/wmSun.c
+++ b/wmSun.c
@@ -69,6 +69,7 @@
 /*
  *   Includes
  */
+#define _POSIX_C_SOURCE 1
 #include <stdio.h>
 #include <math.h>
 #include <unistd.h>
@@ -177,12 +178,14 @@ int main(int argc, char *argv[]) {
 	 *
 	 */
 	if (n>nMAX){
+	    struct tm result;
 
 	    n = 0;
 	    nMAX = 1000;
 
 
-            CurrentGMTTime = time(CurrentTime); GMTTime = gmtime(&CurrentGMTTime);
+	    CurrentGMTTime = time(CurrentTime);
+	    GMTTime = gmtime_r(&CurrentGMTTime, &result);
 	    DayOfMonth = GMTTime->tm_mday;
 
 	    UT = GMTTime->tm_hour + GMTTime->tm_min/60.0 + GMTTime->tm_sec/3600.0;
@@ -190,7 +193,8 @@ int main(int argc, char *argv[]) {
 	    Month = GMTTime->tm_mon+1;
 
 
-	    CurrentLocalTime = CurrentGMTTime; LocalTime = localtime(&CurrentLocalTime);
+	    CurrentLocalTime = CurrentGMTTime;
+	    LocalTime = localtime_r(&CurrentLocalTime, &result);
 	    LocalDayOfMonth = LocalTime->tm_mday;
 
 	    if ((OldLocalDayOfMonth != LocalDayOfMonth)||(Flag)){
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index f707e7f..c624193 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
 		char temp[128];
 
 		while (fgets(temp, 128, fp)) {
-			char *q;
+			char *q, *saveptr;
 			char *tokens = " :\t\n";
 			int key;
 
 			key = 0;
 			q = strdup(temp);
-			q = strtok(q, tokens);
+			q = strtok_r(q, tokens, &saveptr);
 			if(!q)
 				continue;
 			while (key >= 0 && keys[key].label) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmsun.git



More information about the Pkg-wmaker-commits mailing list