[362] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

bug in zwgc/library

daemon@ATHENA.MIT.EDU (Derek Atkins)
Wed May 13 08:46:20 1992

To: bug-zephyr@MIT.EDU
Cc: warlord@MIT.EDU
Date: Wed, 13 May 92 08:45:43 EDT
From: Derek Atkins <warlord@MIT.EDU>

Zephyr doesn't store the window-gram port number in Network-Byte
order.  In other words, if, for example, your port number on a
DECstation were 4887, the file that WGFILE points to would contain
5907.  This is a bug, since when you need to know the port number, you
also need to know whether you on a big-endian or little-endian
machine.  This is only a problem when you try to give the port to
someone at another machine, so its not an otherwise observable
problem, however it is still a bug (IMHO).

-derek

Here are the patches to correct the problem  (a total of 7 chars in
each of three files):

*** /mit/zephyr/src/lib/ZGetWGPort.c    Wed Dec  4 13:51:02 1991
--- ZGetWGPort.c        Wed May 13 08:27:46 1992
***************
*** 43,47 ****

      (void) fclose(fp);

!     return (wgport);
  }
--- 43,47 ----

      (void) fclose(fp);

!     return (htons(wgport));
  }

*** /mit/zephyr/src/zwgc/zephyr.c       Thu Dec  7 17:35:37 1989
--- zephyr.c    Wed May 13 08:30:52 1992
***************
*** 152,158 ****
      errno = 0;
      port_file = fopen(temp, "w+");
      if (port_file) {
!       fprintf(port_file, "%d\n", port);
        fclose(port_file);
      } else {
        fprintf(stderr, "zwgc: error while opening %s for writing: ", temp);
--- 152,158 ----
      errno = 0;
      port_file = fopen(temp, "w+");
      if (port_file) {
!       fprintf(port_file, "%d\n", htons(port));
        fclose(port_file);
      } else {
        fprintf(stderr, "zwgc: error while opening %s for writing: ", temp);

*** /mit/zephyr/src/ozwgc/main.c        Thu Jun 20 10:32:32 1991
--- main.c      Wed May 13 08:37:33 1992
***************
*** 89,95 ****
      exit(1);
    }

!   fprintf(fd, "%d\n", port);

    fclose(fd);
  }
--- 89,95 ----
      exit(1);
    }

!   fprintf(fd, "%d\n", htons(port));

    fclose(fd);
  }

home help back first fref pref prev next nref lref last post