patch-Wnn_jserver_de_c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. $OpenBSD: patch-Wnn_jserver_de_c,v 1.3 2017/04/29 14:31:40 espie Exp $
  2. --- Wnn/jserver/de.c.orig
  3. +++ Wnn/jserver/de.c
  4. @@ -53,6 +53,8 @@
  5. */
  6. #include <stdio.h>
  7. #include <signal.h>
  8. +#include <string.h>
  9. +#include <unistd.h>
  10. #include "commonhd.h"
  11. #include "config.h"
  12. #include "jd_sock.h"
  13. @@ -61,10 +63,16 @@
  14. #include <ctype.h>
  15. #include <errno.h>
  16. -extern int errno; /* Pure BSD */
  17. -
  18. +#include <stdlib.h>
  19. +#include <errno.h>
  20. #include <sys/ioctl.h>
  21. +#include <sys/select.h>
  22. +#include <time.h>
  23. +#include <sys/socket.h>
  24. +#if (defined(__unix__) || defined(unix)) && !defined(USG)
  25. +#include <sys/param.h>
  26. +#endif
  27. #ifdef SYSVR2
  28. #include <sys/param.h>
  29. #ifndef SIGCHLD
  30. @@ -81,6 +89,7 @@ extern int errno; /* Pure BSD */
  31. #include "msg.h"
  32. #ifdef BSD42
  33. +#undef NOFILE
  34. #define NOFILE getdtablesize()
  35. #endif
  36. @@ -187,7 +196,7 @@ int get2_cur();
  37. char cmd_name[80];
  38. /* No arguments are used. Only options. */
  39. -void
  40. +int
  41. main(argc, argv)
  42. int argc;
  43. char **argv;
  44. @@ -264,7 +273,16 @@ char **argv;
  45. fclose(stdin);
  46. fclose(stdout);
  47. if(!noisy){
  48. +#if !(defined(BSD) && (BSD >= 199306)) /* !4.4BSD-Lite by Taoka */
  49. fclose(stderr);
  50. +#else /* 4.4BSD-Lite */
  51. + int fd = open("/dev/null", O_WRONLY);
  52. + if (fd < 0) {
  53. + xerror("Cannot open /dev/null\n");
  54. + }
  55. + dup2(fd, 2);
  56. + close(fd);
  57. +#endif /* 4.4BSD-Lite */
  58. }
  59. #if defined(hpux) || defined(SOLARIS)
  60. @@ -462,7 +480,7 @@ demon_init() /* initialize Demon */
  61. exit(1);
  62. }
  63. #ifdef SRAND48
  64. - srand48(time((long *)0));
  65. + srand48(time(NULL));
  66. #else
  67. srand((int)time((long *)0));
  68. #endif