Here goes the sun. It's all right.

Sorry, could not resist.

alip.

2015-11-24 21:30 GMT+02:00 Sebastian Benoit <be...@openbsd.org>:

> Brent Cook(bust...@gmail.com) on 2015.11.22 16:32:49 -0600:
> >
> > Finally getting around to trying out nc on some more platforms for
> > LibreSSL-portable, and ran into Sun/Oracle's silly definition of 'sun'
> > in the system headers. OK to rename the local sockaddr_un variables?
>
> ok benno@
>
> > Portable contains a patch full of #ifdef's around other systems-specific
> > nc features (e.g. rdomain support). I'm not sure if any of those
> > should also move into cvs or stay in the portable patch.
>
> while for nc it might be fine (small programm etc) i would not like to have
> this elsewhere (i.e. ntpd, relayd, bgpd...) because it will make reading
> the
> code harder.
>
> i'm ok with restructuring our code a bit if it reduces your ifdef hell.
>
> > Index: netcat.c
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/nc/netcat.c,v
> > retrieving revision 1.143
> > diff -u -p -u -p -r1.143 netcat.c
> > --- netcat.c  13 Nov 2015 18:13:13 -0000      1.143
> > +++ netcat.c  22 Nov 2015 22:26:08 -0000
> > @@ -643,7 +643,7 @@ main(int argc, char *argv[])
> >  int
> >  unix_bind(char *path, int flags)
> >  {
> > -     struct sockaddr_un sun;
> > +     struct sockaddr_un s_un;
> >       int s;
> >
> >       /* Create unix domain socket. */
> > @@ -651,17 +651,17 @@ unix_bind(char *path, int flags)
> >           0)) < 0)
> >               return (-1);
> >
> > -     memset(&sun, 0, sizeof(struct sockaddr_un));
> > -     sun.sun_family = AF_UNIX;
> > +     memset(&s_un, 0, sizeof(struct sockaddr_un));
> > +     s_un.sun_family = AF_UNIX;
> >
> > -     if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
> > -         sizeof(sun.sun_path)) {
> > +     if (strlcpy(s_un.sun_path, path, sizeof(s_un.sun_path)) >=
> > +         sizeof(s_un.sun_path)) {
> >               close(s);
> >               errno = ENAMETOOLONG;
> >               return (-1);
> >       }
> >
> > -     if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
> > +     if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
> >               close(s);
> >               return (-1);
> >       }
> > @@ -737,7 +737,7 @@ tls_setup_server(struct tls *tls_ctx, in
> >  int
> >  unix_connect(char *path)
> >  {
> > -     struct sockaddr_un sun;
> > +     struct sockaddr_un s_un;
> >       int s;
> >
> >       if (uflag) {
> > @@ -748,16 +748,16 @@ unix_connect(char *path)
> >                       return (-1);
> >       }
> >
> > -     memset(&sun, 0, sizeof(struct sockaddr_un));
> > -     sun.sun_family = AF_UNIX;
> > +     memset(&s_un, 0, sizeof(struct sockaddr_un));
> > +     s_un.sun_family = AF_UNIX;
> >
> > -     if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
> > -         sizeof(sun.sun_path)) {
> > +     if (strlcpy(s_un.sun_path, path, sizeof(s_un.sun_path)) >=
> > +         sizeof(s_un.sun_path)) {
> >               close(s);
> >               errno = ENAMETOOLONG;
> >               return (-1);
> >       }
> > -     if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
> > +     if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
> >               close(s);
> >               return (-1);
> >       }
> >
>
> --
>
>

Reply via email to