Module Name:    src
Committed By:   joerg
Date:           Fri Mar 24 14:18:19 UTC 2023

Modified Files:
        src/lib/libpthread: pthread.c

Log Message:
Use snprintf_ss in pthread__assertfunc and update comment in
pthread__errorfunc. snprintf can use locks in some code paths and we
only care about the restricted subset here.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/lib/libpthread/pthread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.181 src/lib/libpthread/pthread.c:1.182
--- src/lib/libpthread/pthread.c:1.181	Tue May 31 14:23:39 2022
+++ src/lib/libpthread/pthread.c	Fri Mar 24 14:18:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.181 2022/05/31 14:23:39 riastradh Exp $	*/
+/*	$NetBSD: pthread.c,v 1.182 2023/03/24 14:18:18 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.181 2022/05/31 14:23:39 riastradh Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.182 2023/03/24 14:18:18 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1073,10 +1073,10 @@ pthread__assertfunc(const char *file, in
 	int len;
 
 	/*
-	 * snprintf should not acquire any locks, or we could
+	 * snprintf_ss should not acquire any locks, or we could
 	 * end up deadlocked if the assert caller held locks.
 	 */
-	len = snprintf(buf, 1024,
+	len = snprintf_ss(buf, 1024,
 	    "assertion \"%s\" failed: file \"%s\", line %d%s%s%s\n",
 	    expr, file, line,
 	    function ? ", function \"" : "",
@@ -1106,7 +1106,7 @@ pthread__errorfunc(const char *file, int
 	va_end(ap);
 
 	/*
-	 * snprintf should not acquire any locks, or we could
+	 * snprintf_ss should not acquire any locks, or we could
 	 * end up deadlocked if the assert caller held locks.
 	 */
 	len = snprintf_ss(buf, sizeof(buf),

Reply via email to