9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] ape: getsockname: wrong byte order in sin_port
Date: Tue,  8 Jan 2013 16:02:24 -0500	[thread overview]
Message-ID: <2d9133a4417c29256690480734bd5d69@brasstown.quanstro.net> (raw)
In-Reply-To: <CAG3N4d8Urjyhnw-08BvrER4a90J3+14EU+HrErtxU3kaKNp-NA@mail.gmail.com>

On Tue Jan  8 08:58:26 EST 2013, yarikos@gmail.com wrote:

> APE's getsockname() returns port with bytes swapped (on 386).
> Fix:
>
> /n/dump/2013/0108/sys/src/ape/lib/bsd/_sock_ingetaddr.c:35,41 -
> /sys/src/ape/lib/bsd/_sock_ingetaddr.c:35,41
>   if(p){
>   *p++ = 0;
>   ip->sin_family = AF_INET;
> - ip->sin_port = atoi(p);
> + ip->sin_port = htons(atoi(p));
>   ip->sin_addr.s_addr = inet_addr(name);
>   if(alen)
>   *alen = sizeof(struct sockaddr_in);
>
> Python needs to be relinked.

agree.  patch submitted.  /n/sources/patch/sin_port

- erik



      reply	other threads:[~2013-01-08 21:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 13:57 Yaroslav
2013-01-08 21:02 ` erik quanstrom [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d9133a4417c29256690480734bd5d69@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).