aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.c
Commit message (Collapse)AuthorAge
...
* Merge branch 'bug6097'Nick Mathewson2012-06-11
|\
| * Be more careful calling wcstombsNick Mathewson2012-06-07
| | | | | | | | | | | | | | | | | | | | | | The function is not guaranteed to NUL-terminate its output. It *is*, however, guaranteed not to generate more than two bytes per multibyte character (plus terminating nul), so the general approach I'm taking is to try to allocate enough space, AND to manually add a NUL at the end of each buffer just in case I screwed up the "enough space" thing. Fixes bug 5909.
* | typo noticed by "_raptor"Roger Dingledine2012-06-07
|/
* Merge remote-tracking branch 'public/getfilesize_64'Nick Mathewson2012-06-05
|\ | | | | | | | | | | | | | | Conflicts: src/common/compat.c The getfilesize change conflicted with the removal of file_handle from the windows tor_mmap_t.
| * Use GetFileSize correctly on win32Nick Mathewson2012-05-24
| | | | | | | | | | (Use its second parameter to find the high 32 bits of the file size; check its return value for error conditions.)
* | Resolve about 24 DOCDOCsNick Mathewson2012-06-05
| |
* | Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson2012-06-04
| |
* | Add about 60 more DOCDOC comments to 0.2.3Nick Mathewson2012-06-04
| | | | | | | | | | | | | | | | Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together.
* | Resolve all currently pending DOCDOC items in masterNick Mathewson2012-06-04
| |
* | Merge remote-tracking branch 'public/bug5089'Nick Mathewson2012-05-31
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/test/test_util.c Merge the unit tests; I added some when I did this branch against 0.2.2, and then the test format changed and master added more tests.
| * | Have get_parent_directory() handle "/foo" and "/" correctly.Nick Mathewson2012-05-24
| |/ | | | | | | | | | | | | | | | | | | | | The parent of "/foo" is "/"; and "/" is its own parent. This would cause Tor to fail if you tried to have a PF_UNIX control socket in the root directory. That would be a stupid thing to do for other reasons, but there's no reason to fail like _this_. Bug found by Esteban Manchado Velázquez. Fix for bug 5089; bugfix on Tor 0.2.2.26-beta. Unit test included.
* | Merge remote-tracking branch 'public/close_file_mapping'Nick Mathewson2012-05-31
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/common/compat.h Conflict was between replacement of MS_WINDOWS with _WIN32 in master, and with removal of file_handle from tor_mmap_t struct in close_file_mapping branch (for bug 5951 fix).
| * | reindent CreateFile arguments.Nick Mathewson2012-05-31
| | |
| * | Close the windows file handle after CreateFileMapping; it isn't neededNick Mathewson2012-05-23
| |/ | | | | | | I did the changes file; the rest came pseudonymously
* | Merge remote-tracking branch 'linus/bug5355_ln'Nick Mathewson2012-05-31
|\ \
| * | Don't stomp on errno.Linus Nordberg2012-05-29
| | |
| * | Refactor new getcwd codeNick Mathewson2012-05-10
| | | | | | | | | | | | | | | | | | Make sure that the "path_length *= 2" statement can't overflow. Move the "malloc and getcwd" loop into its own function.
| * | Stop using MAX_PATH, it might not be definedSebastian Hahn2012-03-10
| | | | | | | | | | | | This broke compilation on Hurd
* | | Fix win32 compilation of 31eb73f88e8Nick Mathewson2012-05-14
| | |
* | | Cut down on the OS information we give.Nick Mathewson2012-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | For uname-based detection, we now give only the OS name (e.g., "Darwin", "Linux".) For Windows, we give only the Operating System name as inferred from dw(Major|Minor)version, (e.g., "Windows XP", "Windows 7"), and whether the VER_NT_SERVER flag is set. For ticket 2988.
* | | Merge remote-tracking branch 'public/bug5091'Nick Mathewson2012-05-11
|\ \ \
| * | | Fix tor_strtok_r_impl and test cases per bug #5091nils2012-03-30
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | == Nick here. I tweaked this patch a little to make it apply cleanly to master, to extract some common code into a function, and to replace snprintf with tor_snprintf. -- nickm
* | | fix quad typo in commentsRoger Dingledine2012-05-07
| | | | | | | | | | | | | | | i assume if nickm maintained "libeven" this would never have been introduced. :)
* | | Fix bug 5762: detect missing accept4 that gives ENOSYSNick Mathewson2012-05-04
| | | | | | | | | | | | | | | | | | | | | We had been checking for EINVAL, but that means that SOCK_* isn't supported, not that the syscall itself is missing. Bugfix on 0.2.3.1-alpha, which started to use accept4.
* | | Remove __ from HAVE_EXTERN_ENVIRON_DECLARED__Nick Mathewson2012-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I think that the trailing __ got added in false analogy to HAVE_MACRO__func__, HAVE_MACRO__FUNC__, and HAVE_MACRO__FUNCTION__. But those macros actually indicate the presence of __func__, __FUNC__, and __FUNCTION__ respectively. The __ at the end of HAVE_EXTERN_ENVIRON_DECLARED would only be appropriate if the environ were declared__, whatever that means. (As a side-note, HAVE_MACRO__func__ and so on should probably be renamed HAVE_MACRO___func__ and so on. But that can wait.) This is an identifier renaming only.
* | | Merge remote-tracking branch 'public/bug5112'Nick Mathewson2012-04-24
|\ \ \ | |/ / |/| |
| * | If SOCK_CLOEXEC and friends fail, fall back to regular socket() callsNick Mathewson2012-02-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 0.2.3.1-alpha, we've supported the Linux extensions to socket(), open(), socketpair(), and accept() that enable us to create an fd and make it close-on-exec with a single syscall. This not only saves us a syscall (big deal), but makes us less vulnerable to race conditions where we open a socket and then exec before we can make it close-on-exec. But these extensions are not supported on all Linuxes: They were added between 2.6.23 or so and 2.6.28 or so. If you were to build your Tor against a recent Linux's kernel headers, and then run it with a older kernel, you would find yourselve unable to open sockets. Ouch! The solution here is that, when one of these syscalls fails with EINVAL, we should try again in the portable way. This adds an extra syscall in the case where we built with new headers and are running with old ones, but it will at least allow Tor to work. Fixes bug 5112; bugfix on 0.2.3.1-alpha.
* | | Don't redeclare environ if std headers already didSebastian Hahn2012-02-19
| | | | | | | | | | | | | | | This would cause a redundant redeclaration warning on some versions of Linux otherwise.
* | | Use _NSGetEnviron() instead of environ where requiredSebastian Hahn2012-02-14
|/ / | | | | | | | | OS X would otherwise crash with a segfault when linked statically to some libraries.
* | Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32Nick Mathewson2012-01-31
| | | | | | | | | | | | | | | | | | | | | | This commit is completely mechanical; I used this perl script to make it: #!/usr/bin/perl -w -i.bak -p if (/^\s*\#/) { s/MS_WINDOWS/_WIN32/g; s/\bWIN32\b/_WIN32/g; }
* | Actually enable the windows absolute-path codeNick Mathewson2012-01-31
| | | | | | | | | | | | Checking for "WINDOWS" is wrong; our magic macro is MS_WINDOWS Fixes bug 4973; bugfix on 0.2.3.11-alpha.
* | Rename nonconformant identifiers.Nick Mathewson2012-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 4893. These changes are pure mechanical, and were generated with this perl script: /usr/bin/perl -w -i.bak -p s/crypto_pk_env_t/crypto_pk_t/g; s/crypto_dh_env_t/crypto_dh_t/g; s/crypto_cipher_env_t/crypto_cipher_t/g; s/crypto_digest_env_t/crypto_digest_t/g; s/aes_free_cipher/aes_cipher_free/g; s/crypto_free_cipher_env/crypto_cipher_free/g; s/crypto_free_digest_env/crypto_digest_free/g; s/crypto_free_pk_env/crypto_pk_free/g; s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g; s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g; s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g; s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g; s/crypto_new_cipher_env/crypto_cipher_new/g; s/crypto_new_digest_env/crypto_digest_new/g; s/crypto_new_digest256_env/crypto_digest256_new/g; s/crypto_new_pk_env/crypto_pk_new/g; s/crypto_create_crypto_env/crypto_cipher_new/g; s/connection_create_listener/connection_listener_new/g; s/smartlist_create/smartlist_new/g; s/transport_create/transport_new/g;
* | Warn if sizeof(tor_socket_t) != sizeof(SOCKET)Nick Mathewson2012-01-17
| |
* | Use SOCKET_OK macros in even more placesNick Mathewson2012-01-17
| | | | | | | | | | | | Add a TOR_INVALID_SOCKET macro to wrap -1/INVALID_SOCKET. Partial work for bug4533.
* | Convert instances of tor_malloc+tor_snprintf into tor_asprintfNick Mathewson2012-01-16
| | | | | | | | | | | | | | | | | | | | These were found by looking for tor_snprintf() instances that were preceeded closely by tor_malloc(), though I probably converted some more snprintfs as well. (In every case, make sure that the length variable (if any) is removed, renamed, or lowered, so that anything else that might have assumed a longer buffer doesn't exist.)
* | Disallow disabling DisableDebuggerAttachment on runnning TorSebastian Hahn2012-01-04
| | | | | | | | | | Also, have tor_disable_debugger_attach() return a tristate of success/failure/don't-know-how , and only log appropriately.
* | Fix a check-spaces violation in compat.cSebastian Hahn2011-12-30
| | | | | | | | Also fix a comment typo
* | Prepend cwd for relative config file paths.Kamran Riaz Khan2011-12-22
| | | | | | | | | | Modifies filenames which do not start with '/' or '.' on non-Windows platforms; uses _fullpath on Windows.
* | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2011-12-02
|\|
| * tor_accept_socket() should take tor_addr_t for listener argNick Mathewson2011-12-02
| | | | | | | | Fixes bug 4535; bugfix on 0.2.2.28-beta; found by "troll_un"
* | Move disable-debugger-attachment fn to compat where it belongs. Fix whitespaceNick Mathewson2011-11-24
| |
* | Fix compile warning in tor_inet_pton() (on 64bit)Sebastian Hahn2011-11-24
| | | | | | | | This slipped through into 0.2.3.8-alpha unfortunately.
* | Minor tor_inet_pton bug fixesAnders Sundman2011-11-19
| | | | | | | | | | | | | | In particular: * Disallow "0x10::" * Don't blow up on ":" * Disallow "::10000"
* | Fixed of-by-one error in tor_inet_ntopAnders Sundman2011-11-11
| | | | | | | | The of-by-one error could lead to 1 byte buffer over runs IPv6 for addresses.
* | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2011-10-03
|\|
| * Looks like Windows version 6.2 will be Windows 8Sebastian Hahn2011-10-01
| | | | | | | | Thanks to funkstar for the report
* | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2011-07-01
|\|
| * Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson2011-07-01
| |\
| | * Fix insanely large stack_allocation in log_credential_statusNick Mathewson2011-07-01
| | | | | | | | | | | | | | | | | | | | | I'm not one to insist on C's miserly stack limits, but allocating a 256K array on the stack is too much even for me. Bugfix on 0.2.1.7-alpha. Found by coverity. Fixes CID # 450.
* | | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2011-06-22
|\| |