From d165cb43488f906a3d56bd81ddd69ff2ac9c7942 Mon Sep 17 00:00:00 2001 From: brooks Date: Thu, 18 Jul 2019 21:33:55 +0000 Subject: [PATCH] Document that setmode(3) is not thread safe. In some circumstances, setmode(3) may call umask(2) twice to retrieve the current mode and then restore it. Between calls, the process will have a umask of 0. Reviewed by: markj Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D20982 --- lib/libc/gen/setmode.3 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/setmode.3 b/lib/libc/gen/setmode.3 index 60a161b49144..3e6796239db0 100644 --- a/lib/libc/gen/setmode.3 +++ b/lib/libc/gen/setmode.3 @@ -28,7 +28,7 @@ .\" @(#)setmode.3 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd February 22, 2015 +.Dd July 18, 2019 .Dt SETMODE 3 .Os .Sh NAME @@ -125,3 +125,10 @@ and .Fn setmode functions first appeared in .Bx 4.4 . +.Sh BUGS +The +.Fn setmode +function is not thread safe. +Files created in other threads while +.Fn setmode +is being called may be created with a umask of 0.