Age | Commit message (Collapse) | Author |
|
|
|
Signed-off-by: David Goulet <dgoulet@torproject.org>
|
|
Closes 23528.
|
|
|
|
Our unit tests will need this, so that they can simulate advancing
time without getting libevent involved.
|
|
|
|
Closes ticket 22824.
|
|
There are two reasons this is likeliest to happen -- no kernel
support, and some bug in Tor. We'll ask people to check the former
before they report. Closes 23090.
|
|
This is probably what the user wants, according to 20119.
|
|
|
|
By convention, a function that frobs a foo_t should be called
foo_frob, and it should have a foo_t * as its first argument. But
for many of the buf_t functions, the buf_t was the final argument,
which is silly.
|
|
|
|
Our convention is that functions which manipulate a type T should be
named T_foo. But the buffer functions were super old, and followed
all kinds of conventions. Now they're uniform.
Here's the perl I used to do this:
\#!/usr/bin/perl -w -i -p
s/read_to_buf\(/buf_read_from_socket\(/;
s/flush_buf\(/buf_flush_to_socket\(/;
s/read_to_buf_tls\(/buf_read_from_tls\(/;
s/flush_buf_tls\(/buf_flush_to_tls\(/;
s/write_to_buf\(/buf_add\(/;
s/write_to_buf_compress\(/buf_add_compress\(/;
s/move_buf_to_buf\(/buf_move_to_buf\(/;
s/peek_from_buf\(/buf_peek\(/;
s/fetch_from_buf\(/buf_get_bytes\(/;
s/fetch_from_buf_line\(/buf_get_line\(/;
s/fetch_from_buf_line\(/buf_get_line\(/;
s/buf_remove_from_front\(/buf_drain\(/;
s/peek_buf_startswith\(/buf_peek_startswith\(/;
s/assert_buf_ok\(/buf_assert_ok\(/;
|
|
These are no longer tor-specific, so they can be part of the
infrastructure.
|
|
|
|
We only did this on windows when building with MSVC 6 and earlier,
which is now considered a screamingly bad idea.
|
|
Telling these functions to autodetect the numeric base has lead to
trouble in the past.
Fixes bug 22469. Bugfix on 0.2.2.various.
|
|
|
|
|
|
coccinelle was getting confused
|
|
|
|
|
|
|
|
The contract is that, if may_spawn_background_process() is 0, you're
not even allowed to try to spawn a process.
|
|
Core of an implementation for 22976.
|
|
|
|
The biggest offender here was sometimes not checking the output of
crypto_pk_get_digest.
Fixes bug 19418. Reported by Guido Vranken.
|
|
This avoids a double-free when a pointer already freed with
tor_free(config_line) is freed again in the cleanup-and-exit code.
Fixes bug 23155.
|
|
The interior of ctx here is already wiped by
crypto_digest_free(). This memwipe call only wiped the pointer
itself, which isn't sensitive.
|
|
|
|
This is partial revert on 22286.
Also, tweak some log messages to be distinct.
|
|
|
|
|
|
We assume that tor_free() is not required to be compatible with
the platform malloc(), so we need to use a strdup here.
|
|
The GNU C Library (glibc) offers an function which allocates the
necessary memory automatically [0]. When it is available, we use that.
Otherwise we depend upon the `getcwd` function which requires a
preallocated buffer (and its size). This function was used incorrectly
by depending on the initial buffer size being big enough and otherwise
failing to return the current working directory. The proper way of
getting the current working directory requires a loop which doubles the
buffer size if `getcwd` requires it. This code was copied from [1] with
modifications to fit the context.
[0] https://www.gnu.org/software/hurd/hurd/porting/guidelines.html
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html
|
|
|
|
|
|
We don't actually want Coverity to complain when a BUG() check can
never fail, since such checks can prevent us from introducing bugs
later on.
Closes ticket 23054. Closes CID 1415720, 1415724.
|
|
|
|
|
|
|
|
|
|
|
|
These comments said that each thread had a separate queue, but we
haven't been using that design for some while.
|
|
Instead of choosing a lower-priority job with a 1/37 chance, have
the chance be 1/37 for half the threads, and 1/2147483647 for the
other half. This way if there are very slow jobs of low priority,
they shouldn't be able to grab all the threads when there is better
work to do.
|
|
Each piece of queued work now has an associated priority value; each
priority goes on a separate queue.
With probability (N-1)/N, the workers will take work from the highest
priority nonempty queue. Otherwise, they'll look for work in a
queue of lower priority. This behavior is meant to prevent
starvation for lower-priority tasks.
|
|
|
|
|
|
|
|
|