Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread Use snprintf_ss in pthread__assertfunc and up...



details:   https://anonhg.NetBSD.org/src/rev/3d298867518a
branches:  trunk
changeset: 374016:3d298867518a
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Mar 24 14:18:18 2023 +0000

description:
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.

diffstat:

 lib/libpthread/pthread.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r c0326520f414 -r 3d298867518a lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Fri Mar 24 13:32:19 2023 +0000
+++ b/lib/libpthread/pthread.c  Fri Mar 24 14:18:18 2023 +0000
@@ -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),



Home | Main Index | Thread Index | Old Index