* [PATCH] localeconv.3: Add description of the function is not thread-safe
@ 2010-12-23 9:10 Peng Haitao
0 siblings, 0 replies; 3+ messages in thread
From: Peng Haitao @ 2010-12-23 9:10 UTC (permalink / raw)
To: Michael Kerrisk; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
Hi Michael,
The function "localeconv" returns a pointer to a structure which might be
overwritten by subsequent calls to `localeconv' or by calls to `setlocale',
so it is not thread-safe.
Signed-off-by: Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
man3/localeconv.3 | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/man3/localeconv.3 b/man3/localeconv.3
index 7b6a1da..86b2624 100644
--- a/man3/localeconv.3
+++ b/man3/localeconv.3
@@ -21,7 +21,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" License.
.\" Modified Sat Jul 24 19:01:20 1993 by Rik Faith (faith-+5Oa3zvhR2o3uPMLIKxrzw@public.gmane.org)
-.TH LOCALECONV 3 1993-04-25 "GNU" "Linux Programmer's Manual"
+.TH LOCALECONV 3 2010-12-23 "GNU" "Linux Programmer's Manual"
.SH NAME
localeconv \- get numeric formatting information
.SH SYNOPSIS
@@ -47,6 +47,13 @@ Programs may also use the functions
and
.BR strfmon (3),
which behave according to the actual locale in use.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR localeconv ()
+function is not thread-safe, since it returns a pointer to a structure which
+might be overwritten by subsequent calls to `localeconv' or by calls to
+`setlocale'.
.SH "CONFORMING TO"
C89, C99.
.SH BUGS
--
1.7.0.1
--
Best Regards,
Peng Haitao
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] localeconv.3: Add description of the function is not thread-safe
@ 2013-03-12 10:43 Peng Haitao
[not found] ` <1363085000-6967-1-git-send-email-penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Peng Haitao @ 2013-03-12 10:43 UTC (permalink / raw)
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
The function localeconv() returns a pointer to a structure which might be
overwritten by subsequent calls to localeconv() or by calls to setlocale(),
so it is not thread-safe.
Signed-off-by: Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
man3/localeconv.3 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/man3/localeconv.3 b/man3/localeconv.3
index 9a776f8..20f1942 100644
--- a/man3/localeconv.3
+++ b/man3/localeconv.3
@@ -21,7 +21,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" License.
.\" Modified Sat Jul 24 19:01:20 1993 by Rik Faith (faith-+5Oa3zvhR2o3uPMLIKxrzw@public.gmane.org)
-.TH LOCALECONV 3 1993-04-25 "GNU" "Linux Programmer's Manual"
+.TH LOCALECONV 3 2013-03-12 "GNU" "Linux Programmer's Manual"
.SH NAME
localeconv \- get numeric formatting information
.SH SYNOPSIS
@@ -47,6 +47,12 @@ Programs may also use the functions
and
.BR strfmon (3),
which behave according to the actual locale in use.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR localeconv ()
+function is not thread-safe, since it returns a pointer to a structure which
+might be overwritten by subsequent calls.
.SH CONFORMING TO
C89, C99.
.SH BUGS
--
1.8.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] localeconv.3: Add description of the function is not thread-safe
[not found] ` <1363085000-6967-1-git-send-email-penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
@ 2013-03-17 10:07 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2013-03-17 10:07 UTC (permalink / raw)
To: Peng Haitao; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
Hello Peng,
On Tue, Mar 12, 2013 at 11:43 AM, Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
> The function localeconv() returns a pointer to a structure which might be
> overwritten by subsequent calls to localeconv() or by calls to setlocale(),
> so it is not thread-safe.
I've applied this patch in my local branch for the ATTRIBUTES work.
See also my general comments in the reply to the ecvt.3 patch.
Here we have a page that could do with other improvements also, and it
is probably worth making such improvements as we go. What I mean is:
the page make no other mention that the returned pointer may (okay, in
glibc *does*) point to a statically allocated object that is
overwritten by subsequent calls. If you notice cases such as this, you
might like to add an extra piece to your patch, such as I have doe in
the patch below (I added some other details as well that I wouldn't
expect you to add), or you could alert me, and maybe I will add a
suitable patch.
Thanks for the patch.
Cheers,
Michael
diff --git a/man3/localeconv.3 b/man3/localeconv.3
index 80a2a21..b449211 100644
--- a/man3/localeconv.3
+++ b/man3/localeconv.3
@@ -49,6 +49,19 @@ Programs may also use the functions
and
.BR strfmon (3),
which behave according to the actual locale in use.
+.SH RETURN VALUE
+The
+.BR localeconv ()
+function returns a pointer to a filled in
+.IR "struct lconv" .
+This structure may be (in glibc,
+.IR is )
+statically allocated, and may be overwritten by subsequent calls.
+According to POSIX,
+the caller should not modify the contents of this structure.
+The
+.BR localeconv ()
+function always succeeds.
.SH ATTRIBUTES
.SS Multithreading (see pthreads(7))
The
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-17 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-23 9:10 [PATCH] localeconv.3: Add description of the function is not thread-safe Peng Haitao
-- strict thread matches above, loose matches on Subject: below --
2013-03-12 10:43 Peng Haitao
[not found] ` <1363085000-6967-1-git-send-email-penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2013-03-17 10:07 ` Michael Kerrisk (man-pages)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.