patch-wily_text2_c 510 B

12345678910111213141516171819
  1. $OpenBSD: patch-wily_text2_c,v 1.1 2003/05/24 19:13:08 pvalchev Exp $
  2. --- wily/text2.c.orig Sat Apr 11 13:21:28 1998
  3. +++ wily/text2.c Sat May 24 13:12:29 2003
  4. @@ -136,11 +136,12 @@ text_write(Text *t, char *fname) {
  5. int
  6. text_fd(Text *t, Range sel)
  7. {
  8. - char *file = tmpnam(0);
  9. + char file[40];
  10. int fd;
  11. int input;
  12. - if ((fd = open(file, O_WRONLY|O_CREAT, 0600)) < 0) {
  13. + sprintf(file, "ff.XXXXXXXX");
  14. + if ((fd = mkstemp(file)) < 0) {
  15. perror("open temp file");
  16. (void) unlink(file);
  17. return(-1);