patch-libmsg_connect_c 872 B

12345678910111213141516171819202122232425262728293031323334
  1. $OpenBSD: patch-libmsg_connect_c,v 1.1 2003/05/24 19:13:08 pvalchev Exp $
  2. --- libmsg/connect.c.orig Sun Apr 12 13:37:42 1998
  3. +++ libmsg/connect.c Sat May 24 13:12:29 2003
  4. @@ -109,11 +109,13 @@ client_connect(void)
  5. /* bind it to a unix-domain at a temporary address */
  6. addr.sun_family = AF_UNIX;
  7. - tmpnam(addr.sun_path);
  8. + sprintf(addr.sun_path, "%s/xx.XXXXXXXX", P_tmpdir);
  9. + close(mkstemp(addr.sun_path));
  10. path = strdup(addr.sun_path);
  11. len = strlen(addr.sun_path);
  12. if (bind(s, (struct sockaddr *) &addr, sizeof addr) < 0){
  13. + unlink(path);
  14. perror("bind");
  15. return -1;
  16. }
  17. @@ -122,10 +124,14 @@ client_connect(void)
  18. fd = wilyfifotalk(); /* fifo to wily */
  19. if(fd<0)
  20. + {
  21. + unlink(path);
  22. return -1;
  23. + }
  24. nwritten = write(fd, addr.sun_path, len);
  25. close(fd);
  26. if(nwritten !=len){
  27. + unlink(path);
  28. perror("write to wily");
  29. return -1;
  30. }