Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
and I thought I wasn't going to do any rsync coding for a while ...
[rsync/rsync.git]
/
socket.c
diff --git
a/socket.c
b/socket.c
index
6551df4
..
15d991b
100644
(file)
--- a/
socket.c
+++ b/
socket.c
@@
-320,13
+320,17
@@
char *client_addr(int fd)
struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
int length = sizeof(sa);
static char addr_buf[100];
struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
int length = sizeof(sa);
static char addr_buf[100];
+ static int initialised;
+
+ if (initialised) return addr_buf;
+
+ initialised = 1;
if (getpeername(fd, &sa, &length)) {
exit_cleanup(1);
}
if (getpeername(fd, &sa, &length)) {
exit_cleanup(1);
}
-
+
strlcpy(addr_buf,(char *)inet_ntoa(sockin->sin_addr), sizeof(addr_buf)-1);
strlcpy(addr_buf,(char *)inet_ntoa(sockin->sin_addr), sizeof(addr_buf)-1);
-
return addr_buf;
}
return addr_buf;
}
@@
-343,6
+347,11
@@
char *client_name(int fd)
struct hostent *hp;
char **p;
char *def = "UNKNOWN";
struct hostent *hp;
char **p;
char *def = "UNKNOWN";
+ static int initialised;
+
+ if (initialised) return name_buf;
+
+ initialised = 1;
strcpy(name_buf,def);
strcpy(name_buf,def);