summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-10-18 12:04:02 +0200
committerJim Meyering <meyering@redhat.com>2011-10-19 09:31:52 +0200
commit1bb97e2aa16a247304c2492f6b52f2106259dbf4 (patch)
tree8a63168ede9b667bac31e076e853e1a05de07aea /src/tac.c
parentd96c2069d9453ba455540e045046ead19e885ff7 (diff)
downloadcoreutils-1bb97e2aa16a247304c2492f6b52f2106259dbf4.tar.xz
tac: do not let failed allocation cause immediate exit
* src/tac.c (temp_stream): Don't exit immediately upon failed heap allocation, here. That would inhibit processing of any additional command-line arguments.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tac.c b/src/tac.c
index 6a7e51081..7cc562e91 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -430,7 +430,12 @@ temp_stream (FILE **fp, char **file_name)
{
char const *t = getenv ("TMPDIR");
char const *tempdir = t ? t : DEFAULT_TMPDIR;
- tempfile = file_name_concat (tempdir, "tacXXXXXX", NULL);
+ tempfile = mfile_name_concat (tempdir, "tacXXXXXX", NULL);
+ if (tempdir == NULL)
+ {
+ error (0, 0, _("memory exhausted"));
+ return false;
+ }
/* FIXME: there's a small window between a successful mkstemp call
and the unlink that's performed by record_or_unlink_tempfile.