]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
bugfix for win32 with lots of users
authorRoger Dingledine <arma@torproject.org>
Mon, 27 Oct 2003 10:26:44 +0000 (10:26 +0000)
committerRoger Dingledine <arma@torproject.org>
Mon, 27 Oct 2003 10:26:44 +0000 (10:26 +0000)
plus general cleanup on switch_id()

svn:r684

src/common/fakepoll.c
src/common/util.c

index cca6e44215de7cabcd02ec6254ce27b719c4469d..e16f2177ea3ce7f91de43f41380659ef3658778b 100644 (file)
 #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
index 3d20f81049b8b7b3c5eb03d2f068b273f3c8ef2c..525f27b88e41555e2e58d5258c87449578999bd7 100644 (file)
@@ -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;
     }