doc/share/security/patches/SA-00:76/csh.patch
Bjoern A. Zeeb 3571e53040 Import FreeBSD Security Advisories and Errata Notices, as well as their
patches for easier mirroring, to eliminate a special copy, to make
www.freebsd.org/security a full copy of security.freebsd.org and be
eventually be the same.

For now files are just sitting there.   The symlinks are missing.

Discussed on:	www (repository location)
Discussed with:	simon (so)
2012-08-15 06:19:40 +00:00

42 lines
1.1 KiB
Diff

Index: dol.c
===================================================================
RCS file: /mnt/ncvs/src/bin/csh/Attic/dol.c,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -r1.8.2.1 -r1.8.2.2
--- dol.c 1999/08/29 14:11:42 1.8.2.1
+++ dol.c 2000/11/05 21:34:27 1.8.2.2
@@ -40,6 +40,7 @@
#endif
#endif /* not lint */
+#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
@@ -850,13 +851,20 @@
Char **vp;
bool quoted;
char *tmp;
+ struct timeval tv;
- if (creat(tmp = short2str(shtemp), 0600) < 0)
- stderror(ERR_SYSTEM, tmp, strerror(errno));
- (void) close(0);
- if (open(tmp, O_RDWR) < 0) {
+again:
+ tmp = short2str(shtemp);
+ if (open(tmp, O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0600) < 0) {
int oerrno = errno;
-
+ if (errno == EEXIST) {
+ if (unlink(tmp) == -1) {
+ (void) gettimeofday(&tv, NULL);
+ shtemp = Strspl(STRtmpsh, putn((((int)tv.tv_sec) ^
+ ((int)tv.tv_usec) ^ ((int)getpid())) & 0x00ffffff));
+ }
+ goto again;
+ }
(void) unlink(tmp);
errno = oerrno;
stderror(ERR_SYSTEM, tmp, strerror(errno));