=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/error/Attic/touch.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/error/Attic/touch.c 1995/10/18 08:45:06 1.1 +++ src/usr.bin/error/Attic/touch.c 1996/06/25 01:03:59 1.2 @@ -531,6 +531,8 @@ boolean edit(name) char *name; { + int fd; + o_name = name; if ( (o_touchedfile = fopen(name, "r")) == NULL){ fprintf(stderr, "%s: Can't open file \"%s\" to touch (read).\n", @@ -538,8 +540,10 @@ return(TRUE); } (void)strcpy(n_name, canon_name); - (void)mktemp(n_name); - if ( (n_touchedfile = fopen(n_name, "w")) == NULL){ + if ((fd = mkstemp(n_name)) == -1 || + (n_touchedfile = fdopen(fd, "w")) == NULL) { + if (fd != -1) + close(fd); fprintf(stderr,"%s: Can't open file \"%s\" to touch (write).\n", processname, name); return(TRUE);