about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/ngircd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index 626b8b23..d839618f 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -671,6 +671,19 @@ NGIRCd_getNobodyID(uid_t *uid, gid_t *gid )
 {
 	struct passwd *pwd;
 
+#ifdef __CYGWIN__
+	/* Cygwin kludge.
+	 * It can return EINVAL instead of EPERM
+	 * so, if we are already unprivileged,
+	 * use id of current user.
+	 */
+	if (geteuid() && getuid()) {
+		*uid = getuid();
+		*gid = getgid();
+		return true;
+	}
+#endif
+
 	pwd = getpwnam("nobody");
 	if (!pwd) return false;