diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-12-29 10:00:34 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-12-29 10:00:34 -0500 |
commit | e85f0c650c0509ceff777d0a7fafd6c953604ad8 (patch) | |
tree | 519327dc8872d86669392983c2e2b2459d1c777c /src/common/compat.c | |
parent | 4d6a971ba94f22a86577840cdf1b4935cd445a9b (diff) | |
parent | de432d55657ee124bce0e9a4d5f5842088e2e13b (diff) | |
download | tor-e85f0c650c0509ceff777d0a7fafd6c953604ad8.tar.gz tor-e85f0c650c0509ceff777d0a7fafd6c953604ad8.zip |
Merge branch 'resolvemyaddr_squashed'
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 8574bd04c9..e466efdcc5 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -2197,9 +2197,20 @@ get_environment(void) #endif } -/** Set *addr to the IP address (in dotted-quad notation) stored in c. - * Return 1 on success, 0 if c is badly formatted. (Like inet_aton(c,addr), - * but works on Windows and Solaris.) +/** Get name of current host and write it to <b>name</b> array, whose + * length is specified by <b>namelen</b> argument. Return 0 upon + * successfull completion; otherwise return return -1. (Currently, + * this function is merely a mockable wrapper for POSIX gethostname().) + */ +MOCK_IMPL(int, +tor_gethostname,(char *name, size_t namelen)) +{ + return gethostname(name,namelen); +} + +/** Set *addr to the IP address (in dotted-quad notation) stored in *str. + * Return 1 on success, 0 if *str is badly formatted. + * (Like inet_aton(str,addr), but works on Windows and Solaris.) */ int tor_inet_aton(const char *str, struct in_addr* addr) @@ -2419,8 +2430,9 @@ tor_inet_pton(int af, const char *src, void *dst) * (This function exists because standard windows gethostbyname * doesn't treat raw IP addresses properly.) */ -int -tor_lookup_hostname(const char *name, uint32_t *addr) + +MOCK_IMPL(int, +tor_lookup_hostname,(const char *name, uint32_t *addr)) { tor_addr_t myaddr; int ret; |