Use safe temp files. I'll try to cook-up a different version of

these to submit back to the author once I digup my autoconf manual
again.  :(
This commit is contained in:
Tim Vanderhoek 2002-09-02 03:47:53 +00:00
parent 64c8e317da
commit 3df30cd731
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=65468
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,24 @@
--- ../../orig/uudeview-0.5.18/uulib/fptools.c Wed Jun 6 14:21:47 2001
+++ uulib/fptools.c Sun Sep 1 21:57:16 2002
@@ -507,5 +507,20 @@
char * TOOLEXPORT
_FP_tempnam (char *dir, char *pfx)
{
- return _FP_strdup (tmpnam (NULL));
+ /* TODO: should make this patch acceptable for fitting back
+ * into the standard uudeview distribution (rather than the
+ * hack that it is now). */
+
+ char *fname;
+ int fd;
+
+ if ((fname = _FP_strdup ("/tmp/uuXXXXXXX")) != NULL) {
+ if ((fd = mkstemp (fname)) != -1) {
+ close (fd);
+ return fname;
+ } else {
+ _FP_free (fname);
+ }
+ }
+ return NULL;
}

View file

@ -0,0 +1,21 @@
diff -r -u ../../orig/uudeview-0.5.18/uulib/uunconc.c uulib/uunconc.c
--- ../../orig/uudeview-0.5.18/uulib/uunconc.c Tue Apr 2 05:04:52 2002
+++ uulib/uunconc.c Sun Sep 1 21:27:01 2002
@@ -1264,7 +1264,7 @@
else
mode = "wb"; /* otherwise in binary */
- if ((data->binfile = tempnam (NULL, "uu")) == NULL) {
+ if ((data->binfile = _FP_tempnam (NULL, "uu")) == NULL) {
UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
uustring (S_NO_TEMP_NAME));
return UURET_NOMEM;
@@ -1426,7 +1426,7 @@
*/
if (data->uudet == BH_ENCODED && data->binfile) {
- if ((ntmp = tempnam (NULL, "uu")) == NULL) {
+ if ((ntmp = _FP_tempnam (NULL, "uu")) == NULL) {
UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
uustring (S_NO_TEMP_NAME));
progress.action = 0;