summaryrefslogtreecommitdiff
path: root/src/common/compat.c
AgeCommit message (Collapse)Author
2010-02-27Update Tor Project copyright yearsNick Mathewson
2009-05-30Don't attempt to log messages to a controller from a worker thread.Nick Mathewson
This patch adds a function to determine whether we're in the main thread, and changes control_event_logmsg() to return immediately if we're in a subthread. This is necessary because otherwise we will call connection_write_to_buf, which modifies non-locked data structures. Bugfix on 0.2.0.x; fix for at least one of the things currently called "bug 977".
2009-05-27Spell-check Tor.Nick Mathewson
2009-05-13Use a mutex to protect the count of open sockets.Nick Mathewson
This matters because a cpuworker can close its socket when it finishes. Cpuworker typically runs in another thread, so without a lock here, we can have a race condition and get confused about how many sockets are open. Possible fix for bug 939.
2009-05-04Update copyright to 2009.Karsten Loesing
2009-03-03Actually use tor_sscanf() to parse untrusted input.Nick Mathewson
svn:r18761
2009-03-02Add and use set/get_uint64 on onion tags. [bug 604; backportable]Nick Mathewson
It seems that 64-bit Sparc Solaris demands 64-bit-aligned access to uint64_t, but does not 64-bit-align the stack-allocated char array we use for cpuworker tags. So this patch adds a set/get_uint64 pair, and uses them to access the conn_id field in the tag. svn:r18743
2009-02-09Use prctl to reenable core dumps when we have setuid to a non-root user.Nick Mathewson
svn:r18449
2009-02-09Remove some deadcode and use tor_inet_aton uniformly.Nick Mathewson
svn:r18422
2009-01-21Fix warning on panther compile, and bug 913. Backport candidate.Nick Mathewson
svn:r18203
2009-01-20Add a better (non-locale-having) ctypes implementation to avoid protocol and ↵Nick Mathewson
parsing mismatches on different platforms. svn:r18189
2009-01-04Fix the oldest bug in a while: stop accepting 1.2.3 as a valid IPv4 address ↵Nick Mathewson
on any platform. svn:r17887
2009-01-04Remove svn $Id$s from our source, and remove tor --version --version.Nick Mathewson
The subversion $Id$ fields made every commit force a rebuild of whatever file got committed. They were not actually useful for telling the version of Tor files in the wild. svn:r17867
2008-12-30Remove some code that is #ifdefed out, and that we no longer seem to use, if ↵Nick Mathewson
we ever did. svn:r17827
2008-12-22Make freelist_len in memarea.c static; document a few variables.Nick Mathewson
svn:r17741
2008-12-22Add DOCDOC entries for undocumented static and global variables.Nick Mathewson
svn:r17739
2008-12-22Fix most DOCDOCs remaining and/or added by redox.Nick Mathewson
svn:r17734
2008-12-22Add DOCDOC comments for all undocumented functions. Add missing *s to other ↵Nick Mathewson
comments so that they will get recognized as doxygen. svn:r17729
2008-12-11Lower sprintf buffer max to ~SSIZE_T_MAX from SIZE_T_CEILING, since we need ↵Nick Mathewson
to compare it to a signed int. svn:r17600
2008-12-09Better error message when told to setuid to ourself.Nick Mathewson
svn:r17543
2008-12-08Compile without warnings on mingw.tor-0.2.1.8-alphaNick Mathewson
svn:r17522
2008-12-05Try to fix windows mmap code.Nick Mathewson
svn:r17493
2008-12-05Simplify mmap object layout to avoid confusing static analysis tools, and us ↵Nick Mathewson
too. svn:r17490
2008-12-05Fix a hard-to-trigger memory leak in log_credential status. Found by ↵Nick Mathewson
Coverity scan. CID 349. svn:r17484
2008-12-02style cleanupRoger Dingledine
svn:r17457
2008-12-02Add two lseek wrappers to compat.[ch]: one to return current fd position, ↵Nick Mathewson
and one to move the fd to the end of the file. svn:r17454
2008-11-26Cast uid_t and gid_t to unsigned before passing to printf %u.Nick Mathewson
svn:r17392
2008-11-26Use fcntl for file locking when flock() is not available.Nick Mathewson
svn:r17391
2008-11-11apply sebastian's fix for bug 859. Apparently on win32 one must lock at ↵Nick Mathewson
least one byte when locking, but locking a nonexistant byte is okay. ) svn:r17244
2008-11-10Document a couple of functions.Nick Mathewson
svn:r17239
2008-11-10beg nick for some documentation on the locking functionsRoger Dingledine
svn:r17233
2008-11-10better error message when you set User but start tor as non-root.Roger Dingledine
hopefully will address bug 857. svn:r17232
2008-11-09Log a little more when credential-switching fails.Nick Mathewson
svn:r17228
2008-11-07while we're cleaning code, get rid of some unreachable code atRoger Dingledine
the bottom of switch_id svn:r17205
2008-11-07now that we drop privs more thoroughly, switch_id() is no longerRoger Dingledine
idempotent. so now we remember if we've succeeded, and if so we don't even try. svn:r17204
2008-11-07remove more redundant code from r17200Roger Dingledine
svn:r17203
2008-11-07Developers should usually configure with --enable-gcc-warnings, and should ↵Nick Mathewson
regularly make check-spaces. Also, int fn() does not mean the same in C as it does in C++ or Java. svn:r17201
2008-11-07Patch from Jacob Appelbaum and me to make User option more robust, properly ↵Steven Murdoch
set supplementary groups, deprecated the Group option, and log more information on credential switching svn:r17200
2008-09-04Fix mingw build with --enable-gcc-warnings set.Nick Mathewson
svn:r16759
2008-09-01remove some redundant includes. i expect the first one to be a problemRoger Dingledine
for tas, but who knows. svn:r16723
2008-09-01Add a lockfile to the Tor data directory to avoid situations where two Tors ↵Nick Mathewson
start with the same datadir, or where a --list-fingerprints races with a server to create keys, or such. svn:r16722
2008-08-22 r17848@tombo: nickm | 2008-08-22 12:10:11 -0400Nick Mathewson
Make definition of tor_mutex_t go into compat.h, so that it is possible to inline mutexes in critical objects. Add init/uninit functions for mutexes allocated inside other structs. svn:r16623
2008-07-25 r17358@pc-10-8-1-079: nickm | 2008-07-25 16:41:03 +0200Nick Mathewson
Split out the address manipulation functions from compat and util: they were about 21% of the total of those, and spread out too much. svn:r16208
2008-07-24 r17346@aud-055: nickm | 2008-07-24 15:37:19 +0200Nick Mathewson
Make generic address manipulation functions work better. Switch address policy code to use tor_addr_t, so it can handle IPv6. That is a good place to start. svn:r16178
2008-05-16 r19795@catbus: nickm | 2008-05-16 14:54:24 -0400Nick Mathewson
Rename tor_addr_t manipulation functions for a consistent style. svn:r14639
2008-04-23 r15304@tombo: nickm | 2008-04-23 16:31:40 -0400Nick Mathewson
Forward-port: I had apparently broken OSX and Freebsd by not initializing threading before we initialize the logging system. This patch should do so, and fix bug 671. svn:r14430
2008-04-22 r15251@tombo: nickm | 2008-04-22 11:59:46 -0400Nick Mathewson
On platforms using pthreads, allow a thread to acquire a lock it already holds. This is crucial for logging: otherwise any log message thrown from inside the logging process (especially from control.c) will deadlock. Win32 CriticalSections are already recursive. Bug spotted by nwf. Bugfix on 0.2.0.16-alpha. Backport candidate. I hope this is portable. svn:r14406
2008-03-18 r18927@catbus: nickm | 2008-03-18 11:11:49 -0400Nick Mathewson
Combine common code in set_max_file_descriptors(): all that varies from platform to platform in the no-getrlimit() case is the connection limit and the platform name. svn:r14101
2008-03-18 r18923@catbus: nickm | 2008-03-18 11:01:22 -0400Nick Mathewson
Add missing typecasts to log message in set_max_file_descriptors to tell gcc everything is okay on windows. Fixes bug 630. svn:r14099
2008-02-22 r18360@catbus: nickm | 2008-02-21 22:26:32 -0500Nick Mathewson
Make torint.h define ssize_t more robustly; add spaces to last patch svn:r13670