aboutsummaryrefslogtreecommitdiff
path: root/timezone
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2021-09-20 06:03:07 +0900
committerStafford Horne <shorne@gmail.com>2021-11-13 08:08:47 +0900
commitafbf26492a5adccc4c4eda00eb588b0b79e4290a (patch)
tree849888d1c7124734446b182f3329f52d22f9416f /timezone
parentd672a98a1af106bd68deb15576710cd61363f7a6 (diff)
downloadglibc-afbf26492a5adccc4c4eda00eb588b0b79e4290a.tar
glibc-afbf26492a5adccc4c4eda00eb588b0b79e4290a.tar.gz
glibc-afbf26492a5adccc4c4eda00eb588b0b79e4290a.tar.bz2
glibc-afbf26492a5adccc4c4eda00eb588b0b79e4290a.zip
tst-tzset: output reason when creating 4GiB file fails
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.
Diffstat (limited to 'timezone')
-rw-r--r--timezone/tst-tzset.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/timezone/tst-tzset.c b/timezone/tst-tzset.c
index d6da2932bb..3dad42e041 100644
--- a/timezone/tst-tzset.c
+++ b/timezone/tst-tzset.c
@@ -25,6 +25,7 @@
#include <time.h>
#include <unistd.h>
#include <support/check.h>
+#include <inttypes.h>
static int do_test (void);
#define TEST_FUNCTION do_test ()
@@ -103,6 +104,13 @@ static void
test_tz_file (off64_t size)
{
char *path = create_tz_file (size);
+ if (path == NULL)
+ {
+ printf ("creating timezone file of size: %" PRId64 "MiB failed.\n",
+ size / (1024 * 1024));
+ exit (1);
+ }
+
if (setenv ("TZ", path, 1) < 0)
{
printf ("setenv failed: %m\n");