Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/talk PR/24862: Peter Postma: From Andrey Matveev via...



details:   https://anonhg.NetBSD.org/src/rev/1b728bd4ea6c
branches:  trunk
changeset: 559576:1b728bd4ea6c
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 20 17:07:33 2004 +0000

description:
PR/24862: Peter Postma: From Andrey Matveev via OpenBSD:
1. use socklen_t instead of int
2. compare socket error return value to == -1 instead of <= 0

diffstat:

 usr.bin/talk/ctl.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 759f8c4b0572 -r 1b728bd4ea6c usr.bin/talk/ctl.c
--- a/usr.bin/talk/ctl.c        Sat Mar 20 17:02:34 2004 +0000
+++ b/usr.bin/talk/ctl.c        Sat Mar 20 17:07:33 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctl.c,v 1.6 2003/08/07 11:16:03 agc Exp $      */
+/*     $NetBSD: ctl.c,v 1.7 2004/03/20 17:07:33 christos Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)ctl.c      8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: ctl.c,v 1.6 2003/08/07 11:16:03 agc Exp $");
+__RCSID("$NetBSD: ctl.c,v 1.7 2004/03/20 17:07:33 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -66,7 +66,7 @@
 void
 open_sockt()
 {
-       int length;
+       socklen_t length;
 
        
        (void)memset(&my_addr, 0, sizeof(my_addr));
@@ -77,7 +77,7 @@
        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");
@@ -90,7 +90,7 @@
 void
 open_ctl() 
 {
-       int length;
+       socklen_t length;
 
        (void)memset(&ctl_addr, 0, sizeof(ctl_addr));
        ctl_addr.sin_family = AF_INET;
@@ -100,7 +100,7 @@
        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)



Home | Main Index | Thread Index | Old Index