aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McInerney <i.mcinerney17@imperial.ac.uk>2024-04-04 16:16:32 +0100
committerFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2024-04-12 13:52:10 +0200
commit3bd3ca05b519b99b5ea570c10fd80737cd4c6c49 (patch)
treecc593d634ecb71adfda4f0fdce0d5fa38c70f60e
parent6e7e5943619a2c20d93fc7089c885483786558bc (diff)
downloadgcc-3bd3ca05b519b99b5ea570c10fd80737cd4c6c49.zip
gcc-3bd3ca05b519b99b5ea570c10fd80737cd4c6c49.tar.gz
gcc-3bd3ca05b519b99b5ea570c10fd80737cd4c6c49.tar.bz2
libgfortran: Fix compilation of gf_vsnprintf
The fallback function (gf_vsnprintf) to provide a vsnprintf function if the system library doesn't have one would not compile due to the variable name for the string's destination buffer not being updated after the refactor in 2018 in edaaef601d0d6d263fba87b42d6d04c99dd23dba. This updates the internal logic of gf_vsnprintf to now use the str variable defined in the function signature. libgfortran/ChangeLog: 2024-04-04 Ian McInerney <i.mcinerney17@imperial.ac.uk> * runtime/error.c (gf_vsnprintf): Fix compilation Signed-off-by: Ian McInerney <i.mcinerney17@imperial.ac.uk>
-rw-r--r--libgfortran/runtime/error.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index e840f53..0442982 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -142,15 +142,15 @@ gf_vsnprintf (char *str, size_t size, const char *format, va_list ap)
{
int written;
- written = vsprintf(buffer, format, ap);
+ written = vsprintf(str, format, ap);
if (written >= size - 1)
{
- /* The error message was longer than our buffer. Ouch. Because
+ /* The error message was longer than the string size. Ouch. Because
we may have messed up things badly, report the error and
quit. */
-#define ERROR_MESSAGE "Internal error: buffer overrun in gf_vsnprintf()\n"
- write (STDERR_FILENO, buffer, size - 1);
+#define ERROR_MESSAGE "Internal error: string overrun in gf_vsnprintf()\n"
+ write (STDERR_FILENO, str, size - 1);
write (STDERR_FILENO, ERROR_MESSAGE, strlen (ERROR_MESSAGE));
sys_abort ();
#undef ERROR_MESSAGE