diff options
author | cperciva <cperciva@FreeBSD.org> | 2004-03-21 08:14:39 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2004-03-21 08:14:39 +0000 |
commit | cbd95cfcfc60e974ada9ad0bee3afd99dd7d7697 (patch) | |
tree | 004e48f12060ae1e60bb8d5815e390f03caf1b68 /usr.bin/talk | |
parent | 30920809607d9d3e29dfb685ed3e3b3df8049a13 (diff) | |
download | FreeBSD-src-cbd95cfcfc60e974ada9ad0bee3afd99dd7d7697.zip FreeBSD-src-cbd95cfcfc60e974ada9ad0bee3afd99dd7d7697.tar.gz |
1. Use socklen_t instead of int
2. Compare socket(2) return code to -1, not <= 0.
Obtained from: OpenBSD rev. 1.9
Diffstat (limited to 'usr.bin/talk')
-rw-r--r-- | usr.bin/talk/ctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c index 2597a43..68b229c 100644 --- a/usr.bin/talk/ctl.c +++ b/usr.bin/talk/ctl.c @@ -68,7 +68,7 @@ CTL_MSG msg; void open_sockt() { - int length; + socklen_t length; (void)memset(&my_addr, 0, sizeof(my_addr)); my_addr.sin_family = AF_INET; @@ -76,7 +76,7 @@ open_sockt() my_addr.sin_addr = my_machine_addr; my_addr.sin_port = 0; sockt = socket(AF_INET, SOCK_STREAM, 0); - if (sockt <= 0) + if (sockt == -1) p_error("Bad socket"); if (bind(sockt, (struct sockaddr *)&my_addr, sizeof(my_addr)) != 0) p_error("Binding local socket"); @@ -89,7 +89,7 @@ open_sockt() void open_ctl() { - int length; + socklen_t length; (void)memset(&ctl_addr, 0, sizeof(ctl_addr)); ctl_addr.sin_family = AF_INET; @@ -97,7 +97,7 @@ open_ctl() ctl_addr.sin_port = 0; ctl_addr.sin_addr = my_machine_addr; ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0); - if (ctl_sockt <= 0) + if (ctl_sockt == -1) p_error("Bad socket"); if (bind(ctl_sockt, (struct sockaddr *)&ctl_addr, sizeof(ctl_addr)) != 0) |