[PATCH 20/47] libsemanage: use strtok_r for thread safety

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Use strtok_r(3) for thread safety, not only against concurrent usage
within libsemanage but also other linked libraries in the application.

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libsemanage/src/genhomedircon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index 29ff4259..5e7315d8 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -144,10 +144,10 @@ static void ignore_free(void) {
 }
 
 static int ignore_setup(char *ignoredirs) {
-	char *tok;
+	char *tok, *saveptr = NULL;
 	ignoredir_t *ptr = NULL;
 
-	tok = strtok(ignoredirs, ";");
+	tok = strtok_r(ignoredirs, ";", &saveptr);
 	while(tok) {
 		ptr = calloc(1, sizeof(ignoredir_t));
 		if (!ptr)
@@ -159,7 +159,7 @@ static int ignore_setup(char *ignoredirs) {
 		ptr->next = ignore_head;
 		ignore_head = ptr;
 
-		tok = strtok(NULL, ";");
+		tok = strtok_r(NULL, ";", &saveptr);
 	}
 
 	return 0;
-- 
2.45.2





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux