[PATCH] tst-tzset: output reason when creating 4GiB file fails
Stafford Horne
shorne@gmail.com
Thu Oct 28 21:23:00 GMT 2021
Currently, if the temporary file creation fails the create_tz_file
function returns NULL. The NULL pointer is then passed to setenv which
causes a SIGSEGV. Rather than failing with a SIGSEGV print a warning
and exit.
---
timezone/tst-tzset.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/timezone/tst-tzset.c b/timezone/tst-tzset.c
index d6da2932bb..e6aef6bf51 100644
--- a/timezone/tst-tzset.c
+++ b/timezone/tst-tzset.c
@@ -103,6 +103,13 @@ static void
test_tz_file (off64_t size)
{
char *path = create_tz_file (size);
+ if (path == NULL)
+ {
+ printf ("creating timezone file of size: %lld MiB failed.\n",
+ size / (1024 * 1024));
+ exit (1);
+ }
+
if (setenv ("TZ", path, 1) < 0)
{
printf ("setenv failed: %m\n");
--
2.31.1
More information about the Libc-alpha
mailing list