mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
maint: make tac.c slightly cleaner
* src/tac.c (copy_to_temp): Now that the template string tacXXXXXX is used in only one place, don't bother using a separate variable. Also, using three unconditional assignments seems slightly clearer.
This commit is contained in:
1 parent
866844826c
commit
385634c8dd
1 file changed
+3
-6
@@ -430,12 +430,9 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
|
||||
|
||||
if (template == NULL)
|
||||
{
|
||||
char const * const Template = "tacXXXXXX";
|
||||
tempdir = getenv ("TMPDIR");
|
||||
if (tempdir == NULL)
|
||||
tempdir = DEFAULT_TMPDIR;
|
||||
|
||||
template = file_name_concat (tempdir, Template, NULL);
|
||||
char *t = getenv ("TMPDIR");
|
||||
tempdir = t ? t : DEFAULT_TMPDIR;
|
||||
template = file_name_concat (tempdir, "tacXXXXXX", NULL);
|
||||
}
|
||||
|
||||
/* FIXME: there's a small window between a successful mkstemp call
|
||||
|
||||
Reference in new issue
Block a user