diff options
author | 2005-10-08 17:24:42 +0000 | |
---|---|---|
committer | 2005-10-08 17:24:42 +0000 | |
commit | 4f4d4198504003373b49db33464066dbdea2f216 (patch) | |
tree | b0183d94262648a98a161d870976aba6ae1a9cea /sys-apps/texinfo/files | |
parent | New version. (diff) | |
download | historical-4f4d4198504003373b49db33464066dbdea2f216.tar.gz historical-4f4d4198504003373b49db33464066dbdea2f216.tar.bz2 historical-4f4d4198504003373b49db33464066dbdea2f216.zip |
Fix segfault in previous tempfile fix #108416.
Package-Manager: portage-2.0.53_rc4
Diffstat (limited to 'sys-apps/texinfo/files')
-rw-r--r-- | sys-apps/texinfo/files/digest-texinfo-4.8-r2 | 1 | ||||
-rw-r--r-- | sys-apps/texinfo/files/texinfo-4.8-tempfile.patch | 64 |
2 files changed, 20 insertions, 45 deletions
diff --git a/sys-apps/texinfo/files/digest-texinfo-4.8-r2 b/sys-apps/texinfo/files/digest-texinfo-4.8-r2 new file mode 100644 index 000000000000..89aa6b29dbe2 --- /dev/null +++ b/sys-apps/texinfo/files/digest-texinfo-4.8-r2 @@ -0,0 +1 @@ +MD5 6ba369bbfe4afaa56122e65b3ee3a68c texinfo-4.8.tar.bz2 1521822 diff --git a/sys-apps/texinfo/files/texinfo-4.8-tempfile.patch b/sys-apps/texinfo/files/texinfo-4.8-tempfile.patch index c3c9e93d7a5e..95a8c3f19142 100644 --- a/sys-apps/texinfo/files/texinfo-4.8-tempfile.patch +++ b/sys-apps/texinfo/files/texinfo-4.8-tempfile.patch @@ -1,60 +1,34 @@ +Patch based off code from: Martin Pitt <martin.pitt at ubuntu.com> + http://bugs.gentoo.org/106105 --- util/texindex.c +++ util/texindex.c -@@ -99,6 +99,9 @@ long nlines; - /* Directory to use for temporary files. On Unix, it ends with a slash. */ - char *tempdir; - -+/* Basename for temp files inside of tempdir. */ -+char *tempbase; -+ - /* Number of last temporary file. */ - int tempcount; - -@@ -190,6 +193,11 @@ main (int argc, char **argv) - - decode_command (argc, argv); - -+ /* XXX mkstemp not appropriate, as we need to have somewhat predictable -+ * names. But race condition was fixed, see maketempname. -+ */ -+ tempbase = mktemp ("txidxXXXXXX"); -+ - /* Process input files completely, one by one. */ - - for (i = 0; i < num_infiles; i++) -@@ -392,21 +400,21 @@ For more information about these matters - static char * +@@ -390,11 +390,12 @@ maketempname (int count) { -- static char *tempbase = NULL; + static char *tempbase = NULL; ++ char *tempname; char tempsuffix[10]; -- -- if (!tempbase) -- { -- int fd; -- tempbase = concat (tempdir, "txidxXXXXXX"); -- -- fd = mkstemp (tempbase); -- if (fd == -1) -- pfatal_with_name (tempbase); -- } -+ char *name, *tmp_name; + int fd; + if (!tempbase) + { +- int fd; + tempbase = concat (tempdir, "txidxXXXXXX"); + + fd = mkstemp (tempbase); +@@ -403,7 +404,12 @@ + } + sprintf (tempsuffix, ".%d", count); - return concat (tempbase, tempsuffix); -+ tmp_name = concat (tempdir, tempbase); -+ name = concat (tmp_name, tempsuffix); -+ free(tmp_name); -+ -+ fd = open (name, O_CREAT|O_EXCL|O_WRONLY, 0600); ++ tempname = concat (tempbase, tempsuffix); ++ fd = open (tempname, O_CREAT|O_EXCL|O_WRONLY, 0600); + if (fd == -1) -+ pfatal_with_name (name); -+ -+ close(fd); -+ return name; ++ pfatal_with_name (tempname); ++ close (fd); ++ return tempname; } |