Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.9 KiB

  1. From 8c872d895d50214a23aad90a7cb31a7a51a08e29 Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Wed, 31 Dec 2014 22:08:09 -0600
  4. Subject: [PATCH 08/16] rename socket to avoid a variable called 'sun'
  5. Solaris defines 'sun' as a constant.
  6. ---
  7. src/usr.sbin/ntpd/control.c | 18 +++++++++---------
  8. src/usr.sbin/ntpd/ntpd.c | 12 ++++++------
  9. 2 files changed, 15 insertions(+), 15 deletions(-)
  10. diff --git a/src/usr.sbin/ntpd/control.c b/src/usr.sbin/ntpd/control.c
  11. index 6c5b05d..eb3575b 100644
  12. --- a/src/usr.sbin/ntpd/control.c
  13. +++ b/src/usr.sbin/ntpd/control.c
  14. @@ -36,7 +36,7 @@
  15. int
  16. control_init(char *path)
  17. {
  18. - struct sockaddr_un sun;
  19. + struct sockaddr_un sock;
  20. int fd;
  21. mode_t old_umask;
  22. @@ -45,10 +45,10 @@ control_init(char *path)
  23. return (-1);
  24. }
  25. - bzero(&sun, sizeof(sun));
  26. - sun.sun_family = AF_UNIX;
  27. - if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
  28. - sizeof(sun.sun_path))
  29. + bzero(&sock, sizeof(sock));
  30. + sock.sun_family = AF_UNIX;
  31. + if (strlcpy(sock.sun_path, path, sizeof(sock.sun_path)) >=
  32. + sizeof(sock.sun_path))
  33. errx(1, "ctl socket name too long");
  34. if (unlink(path) == -1)
  35. @@ -59,7 +59,7 @@ control_init(char *path)
  36. }
  37. old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
  38. - if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
  39. + if (bind(fd, (struct sockaddr *)&sock, sizeof(sock)) == -1) {
  40. log_warn("control_init: bind: %s", path);
  41. close(fd);
  42. umask(old_umask);
  43. @@ -108,12 +108,12 @@ control_accept(int listenfd)
  44. {
  45. int connfd;
  46. socklen_t len;
  47. - struct sockaddr_un sun;
  48. + struct sockaddr_un sock;
  49. struct ctl_conn *ctl_conn;
  50. - len = sizeof(sun);
  51. + len = sizeof(sock);
  52. if ((connfd = accept(listenfd,
  53. - (struct sockaddr *)&sun, &len)) == -1) {
  54. + (struct sockaddr *)&sock, &len)) == -1) {
  55. if (errno != EWOULDBLOCK && errno != EINTR)
  56. log_warn("control_accept: accept");
  57. return (0);
  58. diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
  59. index 17ebf67..d764a50 100644
  60. --- a/src/usr.sbin/ntpd/ntpd.c
  61. +++ b/src/usr.sbin/ntpd/ntpd.c
  62. @@ -527,7 +527,7 @@ writefreq(double d)
  63. void
  64. ctl_main(int argc, char *argv[])
  65. {
  66. - struct sockaddr_un sun;
  67. + struct sockaddr_un sock;
  68. struct imsg imsg;
  69. struct imsgbuf *ibuf_ctl;
  70. int fd, n, done, ch, action;
  71. @@ -580,12 +580,12 @@ ctl_main(int argc, char *argv[])
  72. if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  73. err(1, "ntpctl: socket");
  74. - bzero(&sun, sizeof(sun));
  75. - sun.sun_family = AF_UNIX;
  76. - if (strlcpy(sun.sun_path, sockname, sizeof(sun.sun_path)) >=
  77. - sizeof(sun.sun_path))
  78. + bzero(&sock, sizeof(sock));
  79. + sock.sun_family = AF_UNIX;
  80. + if (strlcpy(sock.sun_path, sockname, sizeof(sock.sun_path)) >=
  81. + sizeof(sock.sun_path))
  82. errx(1, "ctl socket name too long");
  83. - if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1)
  84. + if (connect(fd, (struct sockaddr *)&sock, sizeof(sock)) == -1)
  85. err(1, "connect: %s", sockname);
  86. if ((ibuf_ctl = malloc(sizeof(struct imsgbuf))) == NULL)
  87. --
  88. 1.9.1