diff options
author | Roger Dingledine <arma@torproject.org> | 2003-10-27 10:26:44 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-10-27 10:26:44 +0000 |
commit | a27b570788cdac4eb3e90f059e721859d25418e5 (patch) | |
tree | dd825c19257a5639085d97daf95fe0a39dd69908 /src | |
parent | 42b2f341a4e03080161c3f9f61685a97771d02fa (diff) | |
download | tor-a27b570788cdac4eb3e90f059e721859d25418e5.tar tor-a27b570788cdac4eb3e90f059e721859d25418e5.tar.gz |
bugfix for win32 with lots of users
plus general cleanup on switch_id()
svn:r684
Diffstat (limited to 'src')
-rw-r--r-- | src/common/fakepoll.c | 5 | ||||
-rw-r--r-- | src/common/util.c | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/common/fakepoll.c b/src/common/fakepoll.c index cca6e4421..e16f2177e 100644 --- a/src/common/fakepoll.c +++ b/src/common/fakepoll.c @@ -24,6 +24,11 @@ #include <winsock.h> #endif +/* by default, windows handles only 64 fd's */ +#if defined(MS_WINDOWS) && !defined(FD_SETSIZE) +#define FD_SETSIZE MAXCONNECTIONS +#endif + #include "util.h" int diff --git a/src/common/util.c b/src/common/util.c index 3d20f8104..525f27b88 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -589,7 +589,6 @@ void write_pidfile(char *filename) { int switch_id(char *user, char *group) { #ifndef MS_WINDOWS - int status; struct passwd *pw = NULL; struct group *gr = NULL; @@ -609,24 +608,21 @@ int switch_id(char *user, char *group) { return -1; } - status = setgid(gr->gr_gid); - if (status != 0) { + if (setgid(gr->gr_gid) != 0) { log_fn(LOG_ERR,"Error setting GID: %s", strerror(errno)); return -1; } } else if (user) { - status = setgid(pw->pw_gid); - if (status != 0) { + if (setgid(pw->pw_gid) != 0) { log_fn(LOG_ERR,"Error setting GID: %s", strerror(errno)); return -1; } } /* now that the group is switched, we can switch users and lose - priviledges */ + privileges */ if (user) { - status = setuid(pw->pw_uid); - if (status != 0) { + if (setuid(pw->pw_uid) != 0) { log_fn(LOG_ERR,"Error setting UID: %s", strerror(errno)); return -1; } |