aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-18 14:03:49 -0400
committerNick Mathewson <nickm@torproject.org>2015-05-07 15:29:16 -0400
commit79e85313aa611b599f19fea61c38ff3928e1fd59 (patch)
treed6c25dae4999d42a33810134f49d7d650a25b2dc /src/common
parent3668a4126e0c2502a77c2ba5d7885add489a964a (diff)
downloadtor-79e85313aa611b599f19fea61c38ff3928e1fd59.tar.gz
tor-79e85313aa611b599f19fea61c38ff3928e1fd59.zip
Write the outlines of a WritingTests.txt document
Also, add some sample tests to be examples.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tortls.c4
-rw-r--r--src/common/tortls.h2
-rw-r--r--src/common/util.c2
-rw-r--r--src/common/util.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index ca629135a6..43fa7f884d 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -2068,8 +2068,8 @@ tor_tls_free(tor_tls_t *tls)
* number of characters read. On failure, returns TOR_TLS_ERROR,
* TOR_TLS_CLOSE, TOR_TLS_WANTREAD, or TOR_TLS_WANTWRITE.
*/
-int
-tor_tls_read(tor_tls_t *tls, char *cp, size_t len)
+MOCK_IMPL(int,
+tor_tls_read,(tor_tls_t *tls, char *cp, size_t len))
{
int r, err;
tor_assert(tls);
diff --git a/src/common/tortls.h b/src/common/tortls.h
index f8c6d5913b..2aac8af18e 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -77,7 +77,7 @@ int tor_tls_verify(int severity, tor_tls_t *tls, crypto_pk_t **identity);
int tor_tls_check_lifetime(int severity,
tor_tls_t *tls, int past_tolerance,
int future_tolerance);
-int tor_tls_read(tor_tls_t *tls, char *cp, size_t len);
+MOCK_DECL(int, tor_tls_read, (tor_tls_t *tls, char *cp, size_t len));
int tor_tls_write(tor_tls_t *tls, const char *cp, size_t n);
int tor_tls_handshake(tor_tls_t *tls);
int tor_tls_finish_handshake(tor_tls_t *tls);
diff --git a/src/common/util.c b/src/common/util.c
index f7baab0791..037acad87b 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3538,7 +3538,7 @@ finish_daemon(const char *cp)
/** Write the current process ID, followed by NL, into <b>filename</b>.
*/
void
-write_pidfile(char *filename)
+write_pidfile(const char *filename)
{
FILE *pidfile;
diff --git a/src/common/util.h b/src/common/util.h
index 1b8fc74db5..bac4097917 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -410,7 +410,7 @@ int path_is_relative(const char *filename);
/* Process helpers */
void start_daemon(void);
void finish_daemon(const char *desired_cwd);
-void write_pidfile(char *filename);
+void write_pidfile(const char *filename);
/* Port forwarding */
void tor_check_port_forwarding(const char *filename,