In a recent note, Thomas Dickey said:
> Date: Wed, 10 Apr 2002 05:55:25 -0400
>
> iirc, Lynx renames the file to force suffix-rule behavior when reading it. I
I assmmed that was the objective.
> suppose that could be fixed.
>
Perhaps not easily. This reworked patch detects and reports an
attempt to overwrite an existing file. Admittedly this replaces
a mysterious but sometimes tolerable misbehavior with a hard
error and no recovery, but I believe that's beter.
-- gil
--
StorageTek
INFORMATION made POWERFUL
%%% Created Wed Apr 10 09:53:30 MDT 2002 by target lynx.patch. %%%
diff -ru orig/lynx2-8-5/WWW/Library/Implementation/HTUtils.h
lynx2-8-5/WWW/Library/Implementation/HTUtils.h
--- orig/lynx2-8-5/WWW/Library/Implementation/HTUtils.h Tue Jan 1 18:30:08 2002
+++ lynx2-8-5/WWW/Library/Implementation/HTUtils.h Wed Apr 10 09:52:30 2002
@@ -14,6 +14,9 @@
#ifdef HAVE_CONFIG_H
#include <lynx_cfg.h> /* generated by autoconf 'configure' script */
+#if defined(__APPLE__)
+#undef HAVE_MKSTEMP /* not unique enough on OS X. */
+#endif /* __APPLE__ */
#include <sys/types.h>
#include <stdio.h>
diff -ru orig/lynx2-8-5/src/LYUtils.c lynx2-8-5/src/LYUtils.c
--- orig/lynx2-8-5/src/LYUtils.c Tue Jan 1 18:30:08 2002
+++ lynx2-8-5/src/LYUtils.c Wed Apr 10 08:19:58 2002
@@ -3146,10 +3146,15 @@
if (strlen(interim) + strlen(suffix) < LY_MAXPATH - 2
&& (fd = mkstemp(interim)) >= 0) {
sprintf(result, "%s%s", interim, suffix);
- rename(interim, result);
- chmod(result, HIDE_CHMOD); /* (yes, some mkstemps are broken ;-) */
+/* FIXME: rename may obliterate an existing file! */
+ if (LYCanReadFile(result)) {
+ code = FALSE;
+ } else {
+ rename(interim, result);
+ chmod(result, HIDE_CHMOD); /* (yes, some mkstemps are broken ;-) */
+ code = TRUE;
+ }
close(fd);
- code = TRUE;
} else {
code = FALSE;
}