projects
/
freeradius.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5e5c289
)
Leverage configure checks && use select
author
Alan T. DeKok
<aland@freeradius.org>
Thu, 4 Sep 2008 08:35:03 +0000
(10:35 +0200)
committer
Alan T. DeKok
<aland@freeradius.org>
Thu, 4 Sep 2008 08:35:03 +0000
(10:35 +0200)
src/main/radmin.c
patch
|
blob
|
history
diff --git
a/src/main/radmin.c
b/src/main/radmin.c
index
94420b2
..
8cadc2d
100644
(file)
--- a/
src/main/radmin.c
+++ b/
src/main/radmin.c
@@
-32,12
+32,13
@@
RCSID("$Id$")
#include <readline/history.h>
#endif
#include <readline/history.h>
#endif
-/*
- * FIXME: configure checks.
- */
-#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#include <sys/socket.h>
+#endif
+
+#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#include <sys/un.h>
+#endif
static int fr_domain_socket(const char *path)
static int fr_domain_socket(const char *path)
@@
-180,6
+181,21
@@
int main(int argc, char **argv)
memset(buffer, 0, sizeof(buffer));
while (port == 1) {
memset(buffer, 0, sizeof(buffer));
while (port == 1) {
+ int rcode;
+ fd_set readfds;
+
+ FD_ZERO(&readfds);
+ FD_SET(sockfd, &readfds);
+
+ rcode = select(sockfd + 1, &readfds, NULL, NULL, NULL);
+ if (rcode < 0) {
+ if (errno == EINTR) continue;
+
+ fprintf(stderr, "Failed selecting: %s\n",
+ strerror(errno));
+ exit(1);
+ }
+
len = recv(sockfd, buffer + size,
sizeof(buffer) - size - 1, MSG_DONTWAIT);
if (len < 0) {
len = recv(sockfd, buffer + size,
sizeof(buffer) - size - 1, MSG_DONTWAIT);
if (len < 0) {