pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/37002: pkgtools/pbulk libexec/scan utility fails on Linux
>Number: 37002
>Category: pkg
>Synopsis: pkgtools/pbulk libexec/scan utility fails on Linux
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 18 16:20:00 +0000 2007
>Originator: Aleksey Cheusov
>Release: Linux
>Organization:
home
>Environment:
Linux
>Description:
scan fails like this
pkgsrc-0:/# ( . /usr/pkg_pbulk/etc/pbulk.conf;
/usr/pkg_pbulk/libexec/pbulk/scan; )
Scanning...
.................................................. 50/415
.................................................. 100/415
.................................................. 150/415
.................................................. 200/415
.................................................. 250/415
.................................................. 300/415
.................................................. 350/415
.................................................. 400/415
............... 415/415
Resolving...
Scanning...
pbulk-scan: Could not bind socket: Address already in use
pkgsrc-0:/#
This happens because bind(2) is called several times during a few seconds.
Explanation is here (item 3)
http://www.ibm.com/developerworks/linux/library/l-sockpit/index.html
>How-To-Repeat:
master_mode=yes
limited_list=/not_empty_file
>Fix:
Index: files/pbulk/pscan/master.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pbulk/files/pbulk/pscan/master.c,v
retrieving revision 1.4
diff -u -r1.4 master.c
--- files/pbulk/pscan/master.c 21 Jul 2007 15:36:36 -0000 1.4
+++ files/pbulk/pscan/master.c 18 Sep 2007 16:12:30 -0000
@@ -204,6 +204,7 @@
struct event listen_event;
struct sockaddr_in dst;
int fd;
+ int one = 1;
LIST_INIT(&active_peers);
LIST_INIT(&inactive_peers);
@@ -220,6 +221,8 @@
if (ioctl(fd, FIOCLEX, NULL) == -1)
err(1, "Could not set close-on-exec flag");
#endif
+ if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof (one)) == -1)
+ err(1, "Could not setsockopt");
if (bind(fd, (struct sockaddr *)&dst, sizeof(dst)) == -1)
err(1, "Could not bind socket");
if (listen(fd, 5) == -1)
Home |
Main Index |
Thread Index |
Old Index