commit c505c9dba870a7b47ef7b50e65081c5de36e6c7f from: tobias date: Sat May 17 07:46:49 2025 UTC Set EOVERFLOW for overflow conditions to match POSIX. This brings the wprintf family of functions back in sync with printf family of functions which have been already adjusted. While at it, also sync the documentation to explain possible errno values. OK deraadt@, millert@ commit - 78b89de1503e78ae9e172787f7095d21e03d55b7 commit + c505c9dba870a7b47ef7b50e65081c5de36e6c7f blob - f968ebbe0ba1638698510180fef052ff342c7e1c blob + e321a7989800182b3c6c53366e0fe00a376711b1 --- lib/libc/stdio/vfwprintf.c +++ lib/libc/stdio/vfwprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfwprintf.c,v 1.23 2023/10/06 16:41:02 millert Exp $ */ +/* $OpenBSD: vfwprintf.c,v 1.24 2025/05/17 07:46:49 tobias Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -1059,7 +1059,7 @@ error: goto finish; overflow: - errno = ENOMEM; + errno = EOVERFLOW; ret = -1; finish: @@ -1450,7 +1450,7 @@ done: goto finish; overflow: - errno = ENOMEM; + errno = EOVERFLOW; ret = -1; finish: blob - 05ed0842640579fd696319c5647f17efad55f0f1 blob + 78341785de9006ec6f7a4f52af79e079460f5e2a --- lib/libc/stdio/wprintf.3 +++ lib/libc/stdio/wprintf.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wprintf.3,v 1.10 2022/03/31 17:27:16 naddy Exp $ +.\" $OpenBSD: wprintf.3,v 1.11 2025/05/17 07:46:49 tobias Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" -.Dd $Mdocdate: March 31 2022 $ +.Dd $Mdocdate: May 17 2025 $ .Dt WPRINTF 3 .Os .Sh NAME @@ -584,6 +584,21 @@ In no case does a non-existent or small field width ca a numeric field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result. +.Sh ERRORS +In addition to the errors documented for the +.Xr write 2 +system call, the +.Fn wprintf +family of functions may fail if: +.Bl -tag -width Er +.It Bq Er EILSEQ +An invalid wide character code was encountered. +.It Bq Er ENOMEM +Insufficient storage space is available. +.It Bq Er EOVERFLOW +The return value would be too large to be represented by an +.Vt int . +.El .Sh SEE ALSO .Xr btowc 3 , .Xr fputws 3 ,