diff options
author | teor <teor2345@gmail.com> | 2015-01-10 17:20:06 +1100 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2015-01-10 17:20:06 +1100 |
commit | f8ffb57bc4430ff9bbd7560eecdda4284b2799ba (patch) | |
tree | 7b73b0bf39d756c31bb62dbcd3c239864a6a46c8 /src/common/compat.c | |
parent | debd7862bb6d641c13fe4ee019da633c683d740e (diff) | |
parent | 33df3e37ffecfed309a1a0f210a96620c0ebb837 (diff) | |
download | tor-f8ffb57bc4430ff9bbd7560eecdda4284b2799ba.tar.gz tor-f8ffb57bc4430ff9bbd7560eecdda4284b2799ba.zip |
Merge branch 'master' of https://git.torproject.org/tor into bug13111-empty-key-files-fn-empty
Conflicts:
src/or/connection_edge.c
Merged in favour of origin.
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 404f4f189f..6d36321193 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** @@ -2198,9 +2198,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) @@ -2420,8 +2431,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; |