Deleted Added
full compact
bindresvport.c (181111) bindresvport.c (221420)
1/* This file has be substantially modified from the original OpenBSD source */
2
3/* $OpenBSD: bindresvport.c,v 1.17 2005/12/21 01:40:22 millert Exp $ */
4
5/*
6 * Copyright 1996, Jason Downs. All rights reserved.
7 * Copyright 1998, Theo de Raadt. All rights reserved.
8 * Copyright 2000, Damien Miller. All rights reserved.

--- 75 unchanged lines hidden (view full) ---

84 } else {
85 errno = EPFNOSUPPORT;
86 return (-1);
87 }
88 sa->sa_family = af;
89
90 port = ntohs(*portp);
91 if (port == 0)
1/* This file has be substantially modified from the original OpenBSD source */
2
3/* $OpenBSD: bindresvport.c,v 1.17 2005/12/21 01:40:22 millert Exp $ */
4
5/*
6 * Copyright 1996, Jason Downs. All rights reserved.
7 * Copyright 1998, Theo de Raadt. All rights reserved.
8 * Copyright 2000, Damien Miller. All rights reserved.

--- 75 unchanged lines hidden (view full) ---

84 } else {
85 errno = EPFNOSUPPORT;
86 return (-1);
87 }
88 sa->sa_family = af;
89
90 port = ntohs(*portp);
91 if (port == 0)
92 port = (arc4random() % NPORTS) + STARTPORT;
92 port = arc4random_uniform(NPORTS) + STARTPORT;
93
94 /* Avoid warning */
95 error = -1;
96
97 for(i = 0; i < NPORTS; i++) {
98 *portp = htons(port);
99
100 error = bind(sd, sa, salen);

--- 18 unchanged lines hidden ---
93
94 /* Avoid warning */
95 error = -1;
96
97 for(i = 0; i < NPORTS; i++) {
98 *portp = htons(port);
99
100 error = bind(sd, sa, salen);

--- 18 unchanged lines hidden ---