summaryrefslogtreecommitdiff
path: root/src/common/compat.c
AgeCommit message (Collapse)Author
2012-09-04Rename configure.in to configure.acNick Mathewson
This is the preferred filename to use with Autoconf 2.50 and later.
2012-06-15fix a compiler warning added in one of my XXX023 fixes.Nick Mathewson
2012-06-15Refactor GETINFO process/descriptor-limitNick Mathewson
Previously it duplicated some getrlimit code and content from compat.c; now it doesn't.
2012-06-15Triage the XXX023 and XXX022 comments: postpone many.Nick Mathewson
2012-06-11Merge branch 'bug6097'Nick Mathewson
2012-06-07typo noticed by "_raptor"Roger Dingledine
2012-06-07Be more careful calling wcstombsNick Mathewson
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.
2012-06-05Merge remote-tracking branch 'public/getfilesize_64'Nick Mathewson
Conflicts: src/common/compat.c The getfilesize change conflicted with the removal of file_handle from the windows tor_mmap_t.
2012-06-05Resolve about 24 DOCDOCsNick Mathewson
2012-06-04Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson
2012-06-04Add about 60 more DOCDOC comments to 0.2.3Nick Mathewson
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.
2012-06-04Resolve all currently pending DOCDOC items in masterNick Mathewson
2012-05-31Merge remote-tracking branch 'public/bug5089'Nick Mathewson
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.
2012-05-31Merge remote-tracking branch 'public/close_file_mapping'Nick Mathewson
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).
2012-05-31reindent CreateFile arguments.Nick Mathewson
2012-05-31Merge remote-tracking branch 'linus/bug5355_ln'Nick Mathewson
2012-05-29Don't stomp on errno.Linus Nordberg
2012-05-24Have get_parent_directory() handle "/foo" and "/" correctly.Nick Mathewson
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.
2012-05-24Use GetFileSize correctly on win32Nick Mathewson
(Use its second parameter to find the high 32 bits of the file size; check its return value for error conditions.)
2012-05-23Close the windows file handle after CreateFileMapping; it isn't neededNick Mathewson
I did the changes file; the rest came pseudonymously
2012-05-14Fix win32 compilation of 31eb73f88e8Nick Mathewson
2012-05-11Cut down on the OS information we give.Nick Mathewson
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.
2012-05-11Merge remote-tracking branch 'public/bug5091'Nick Mathewson
2012-05-10Refactor new getcwd codeNick Mathewson
Make sure that the "path_length *= 2" statement can't overflow. Move the "malloc and getcwd" loop into its own function.
2012-05-07fix quad typo in commentsRoger Dingledine
i assume if nickm maintained "libeven" this would never have been introduced. :)
2012-05-04Fix bug 5762: detect missing accept4 that gives ENOSYSNick Mathewson
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.
2012-04-30Remove __ from HAVE_EXTERN_ENVIRON_DECLARED__Nick Mathewson
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.
2012-04-24Merge remote-tracking branch 'public/bug5112'Nick Mathewson
2012-03-30Fix tor_strtok_r_impl and test cases per bug #5091nils
== 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
2012-03-10Stop using MAX_PATH, it might not be definedSebastian Hahn
This broke compilation on Hurd
2012-02-19Don't redeclare environ if std headers already didSebastian Hahn
This would cause a redundant redeclaration warning on some versions of Linux otherwise.
2012-02-14Use _NSGetEnviron() instead of environ where requiredSebastian Hahn
OS X would otherwise crash with a segfault when linked statically to some libraries.
2012-02-14If SOCK_CLOEXEC and friends fail, fall back to regular socket() callsNick Mathewson
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.
2012-01-31Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32Nick Mathewson
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; }
2012-01-31Actually enable the windows absolute-path codeNick Mathewson
Checking for "WINDOWS" is wrong; our magic macro is MS_WINDOWS Fixes bug 4973; bugfix on 0.2.3.11-alpha.
2012-01-18Rename nonconformant identifiers.Nick Mathewson
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;
2012-01-17Warn if sizeof(tor_socket_t) != sizeof(SOCKET)Nick Mathewson
2012-01-17Use SOCKET_OK macros in even more placesNick Mathewson
Add a TOR_INVALID_SOCKET macro to wrap -1/INVALID_SOCKET. Partial work for bug4533.
2012-01-16Convert instances of tor_malloc+tor_snprintf into tor_asprintfNick Mathewson
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.)
2012-01-04Disallow disabling DisableDebuggerAttachment on runnning TorSebastian Hahn
Also, have tor_disable_debugger_attach() return a tristate of success/failure/don't-know-how , and only log appropriately.
2011-12-30Fix a check-spaces violation in compat.cSebastian Hahn
Also fix a comment typo
2011-12-22Prepend cwd for relative config file paths.Kamran Riaz Khan
Modifies filenames which do not start with '/' or '.' on non-Windows platforms; uses _fullpath on Windows.
2011-12-02Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-12-02tor_accept_socket() should take tor_addr_t for listener argNick Mathewson
Fixes bug 4535; bugfix on 0.2.2.28-beta; found by "troll_un"
2011-11-24Move disable-debugger-attachment fn to compat where it belongs. Fix whitespaceNick Mathewson
2011-11-24Fix compile warning in tor_inet_pton() (on 64bit)Sebastian Hahn
This slipped through into 0.2.3.8-alpha unfortunately.
2011-11-19Minor tor_inet_pton bug fixesAnders Sundman
In particular: * Disallow "0x10::" * Don't blow up on ":" * Disallow "::10000"
2011-11-11Fixed of-by-one error in tor_inet_ntopAnders Sundman
The of-by-one error could lead to 1 byte buffer over runs IPv6 for addresses.
2011-10-03Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-10-01Looks like Windows version 6.2 will be Windows 8Sebastian Hahn
Thanks to funkstar for the report