aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
AgeCommit message (Collapse)Author
2017-09-28Move around some LCOV_EXCLs in src/commonNick Mathewson
Apparently, my compiler now generates coverage markers for label-only lines, so we need to exclude those too if they are meant to be unreachable.
2017-09-15Merge branch 'scan-build-032'Nick Mathewson
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-15Split some long #if lines to make the #endif annotator happyNick Mathewson
2017-09-15Merge branch 'bug23487_029'Nick Mathewson
2017-09-15Use different variable names for pw_uid usagesNick Mathewson
Catalyst points out that using pw_uid for two different purposes here is likely to be confusing.
2017-09-15Explain the restrictions on divisor in round*_to_next_multiple_ofteor
Closes 23528.
2017-09-12Clear up dead-assignment warnings from scan-buildNick Mathewson
2017-09-12clang scan-build: Fix "dead increment" warnings.Nick Mathewson
For the most part, these indicated a spot where the code could have been better.
2017-09-12Log correctly on owner/user mismatch.Nick Mathewson
Found with clang's scan-build while looking at dead assignments. Fixes bug 23487; bugfix on 1135405c8c6ea31 in 0.2.9.1-alpha
2017-09-06Exit when we can't write to a configured pid fileNick Mathewson
This is probably what the user wants, according to 20119.
2017-08-28Merge branch 'bug22802_squashed'Nick Mathewson
2017-08-28Don't fall back to _atoi64Nick Mathewson
We only did this on windows when building with MSVC 6 and earlier, which is now considered a screamingly bad idea.
2017-08-09Treat a bad tor_spawn_background() as a BUG().Nick Mathewson
The contract is that, if may_spawn_background_process() is 0, you're not even allowed to try to spawn a process.
2017-08-09Add a 'NoExec' option that causes tor_spawn_background() to failNick Mathewson
Core of an implementation for 22976.
2017-07-28Turn base < 0 into a BUG() in our long-parse functions.Nick Mathewson
2017-07-26Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-07-26Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-07-26Suppress clang4-specific -Wdouble-promotion warningsNick Mathewson
Wow, it sure seems like some compilers can't implement isnan() and friends in a way that pleases themselves! Fixes bug 22915. Bug trigged by 0.2.8.1-alpha and later; caused by clang 4.
2017-07-05Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-07-05Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-07-05Only disable -Wfloat-conversion on mingw when it exists.Nick Mathewson
The 22081 fix disabled -Wfloat-conversion, but -Wfloat-conversion didn't exist in every relevant mingw; it was added in GCC 4.9.x some time, if the documentation can be trusted. Bug not in any released version of tor.
2017-07-05Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-07-05Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-07-05Merge branch 'bug22801_028' into maint-0.2.9Nick Mathewson
2017-07-03Fix -Wfloat-conversion C warnings on mingw in clamp_double_to_int64.Nick Mathewson
We just have to suppress these warnings: Mingw's math.h uses gcc's __builtin_choose_expr() facility to declare isnan, isfinite, and signbit. But as implemented in at least some versions of gcc, __builtin_choose_expr() can generate type warnings even from branches that are not taken. Fixes bug 22801; bugfix on 0.2.8.1-alpha.
2017-05-23Fix comments of functions that return tor_snprintfteor
No code changes needed: in the places where we actually check the return value of these functions, we handle it correctly.
2017-05-19strlen() returns size_tNick Mathewson
2017-05-18Add support for %include funcionality on torrc #1922Daniel Pinto
config_get_lines is now split into two functions: - config_get_lines which is the same as before we had %include - config_get_lines_include which actually processes %include
2017-04-04Move config line parsing function to confline.cNick Mathewson
2017-03-17Split strings at newline in tor_get_lines_from_handle().Alexander Færøy
This patch fixes a regression described in bug #21757 that first appeared after commit 6e78ede73f which was an attempt to fix bug #21654. When switching from buffered I/O to direct file descriptor I/O our output strings from get_string_from_pipe() might contain newline characters (\n). In this patch we modify tor_get_lines_from_handle() to ensure that the function splits the newly read string at the newline character and thus might return multiple lines from a single call to get_string_from_pipe(). Additionally, we add a test case to test_util_string_from_pipe() to ensure that get_string_from_pipe() correctly returns multiple lines in a single call. See: https://bugs.torproject.org/21757 See: https://bugs.torproject.org/21654
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-09Use less-than instead of not-equal-to for comparison in read loops.Alexander Færøy
This patch changes a number of read loops in the util module to use less-than comparison instead of not-equal-to comparison. We do this in the case that we have a bug elsewhere that might cause `numread` to become larger than `count` and thus become an infinite loop.
2017-03-09Remove buffered I/O stream usage in process_handle_t.Alexander Færøy
This patch removes the buffered I/O stream usage in process_handle_t and its related utility functions. This simplifies the code and avoids racy code where we used buffered I/O on non-blocking file descriptors. See: https://bugs.torproject.org/21654
2017-03-08Use read(2) instead of fgets(3) when reading process output.Alexander Færøy
This patch modifies `tor_read_all_handle()` to use read(2) instead of fgets(3) when reading the stdout from the child process. This should eliminate the race condition that can be triggered in the 'slow/util/*' tests on slower machines running OpenBSD, FreeBSD and HardenedBSD. See: https://bugs.torproject.org/21654
2017-03-01Use tor_fgets() instead of fgets().Alexander Færøy
This patch changes our use of fgets() to tor_fgets() for more consistent error handling across different versions of the C library.
2017-02-14Merge branch 'bug20894_029_v3'Nick Mathewson
2017-02-14Don't atoi off the end of a buffer chunk.Nick Mathewson
Fixes bug 20894; bugfix on 0.2.0.16-alpha. We already applied a workaround for this as 20834, so no need to freak out (unless you didn't apply 20384 yet).
2017-02-03Use the standard OpenBSD preprocessor definitioncypherpunks
2016-12-23This is no longer inline.Nick Mathewson
2016-12-23Fix unreachable heap corruption in base64_decode()Hans Jerry Illikainen
Give size_mul_check() external linkage and use it in base64_decode() to avoid a potential integer wrap. Closes #19222
2016-12-16Merge branch 'prop271_030_v1_squashed'Nick Mathewson
2016-12-01Add an extra warning message to check_private_dirteor
2016-11-30Teach parse_iso_time about the spaceless variant.Nick Mathewson
(We previously added support for generating the spaceless 2016-11-14T19:58:12 variant, but not for actually parsing it.)
2016-11-16finish_writing_to_file_impl(): Remove temporary file if replacing the ↵Fabian Keil
existing one failed Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-11-07Merge branch 'maint-0.2.9'Nick Mathewson
Conflicts: src/or/rendservice.c
2016-11-02Improve comments in check_private_dir and onion poisoningteor
Comment changes only
2016-10-27Automated change to use smartlist_add_strdupovercaffeinated
Use the following coccinelle script to change uses of smartlist_add(sl, tor_strdup(str)) to smartlist_add_strdup(sl, string) (coccinelle script from nickm via bug 20048): @@ expression a; expression b; @@ - smartlist_add + smartlist_add_strdup (a, - tor_strdup( b - ) )
2016-10-27Add implementation of smartlist_add_strdupovercaffeinated
Add smartlist_add_strdup(sl, string) - replaces the use of smartlist_add(sl, tor_strdup(string)). Fixes bug 20048.
2016-10-14Merge remote-tracking branch 'public/spaces_in_unix_addrs'Nick Mathewson