summaryrefslogtreecommitdiff
path: root/helper.c
diff options
context:
space:
mode:
authorian <ian>1998-08-30 19:52:38 +0000
committerian <ian>1998-08-30 19:52:38 +0000
commitc6039ba83709d644380fe7fe0fa34f81cf61afc6 (patch)
tree97482db12d354d7d1d297066ec0a2d51555c2ce0 /helper.c
parent0ab9052b42e1c1a05819d84cf1b2bfb2d9d74381 (diff)
Make IPPORT_RESERVED check work (oops!).
Diffstat (limited to 'helper.c')
-rw-r--r--helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/helper.c b/helper.c
index 409ed7b..3615d77 100644
--- a/helper.c
+++ b/helper.c
@@ -72,7 +72,8 @@ int main(int argc, const char *const *argv) {
if (argc != 3) badusage();
addr= strtoul(argv[1],&ep,16); if (*ep || addr&~0x0ffffffffUL) badusage();
port= strtoul(argv[2],&ep,16); if (*ep || port&~0x0ffffUL) badusage();
- if (port >= IPPORT_RESERVED/2) _exit(EPERM);
+ hport= htons(port);
+ if (hport >= IPPORT_RESERVED/2) _exit(EPERM);
if (chdir(CONFIGDIR)) perrorfail("chdir " CONFIGDIR);
@@ -81,7 +82,6 @@ int main(int argc, const char *const *argv) {
saddr.sin_family= AF_INET;
saddr.sin_port= port;
saddr.sin_addr.s_addr= addr;
- hport= htons(port);
snprintf(fnbuf,sizeof(fnbuf)-1,"byport/%u",hport);
if (!access(fnbuf,X_OK)) authorised();