public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Stafford Horne <shorne@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] tst-tzset: output reason when creating 4GiB file fails Date: Fri, 12 Nov 2021 23:09:07 +0000 (GMT) [thread overview] Message-ID: <20211112230907.CC762385840B@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=afbf26492a5adccc4c4eda00eb588b0b79e4290a commit afbf26492a5adccc4c4eda00eb588b0b79e4290a Author: Stafford Horne <shorne@gmail.com> Date: Mon Sep 20 06:03:07 2021 +0900 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. Diff: --- timezone/tst-tzset.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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");
reply other threads:[~2021-11-12 23:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211112230907.CC762385840B@sourceware.org \ --to=shorne@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).