#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
int switch_id(char *user, char *group) {
#ifndef MS_WINDOWS
- int status;
struct passwd *pw = NULL;
struct group *gr = NULL;
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;
}