mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-30 21:42:59 +00:00 
			
		
		
		
	Make setgroups(3) function optional
For example, Interix is missing this function, which prevented ngIRCd to build on this platform. When setgroups(3) isn't available, a warning message is issued when ngIRCd starts up.
This commit is contained in:
		| @@ -221,8 +221,8 @@ AC_CHECK_FUNCS([ \ | |||||||
| # Optional functions | # Optional functions | ||||||
| AC_CHECK_FUNCS_ONCE([ | AC_CHECK_FUNCS_ONCE([ | ||||||
| 	arc4random arc4random_stir gai_strerror getnameinfo inet_aton \ | 	arc4random arc4random_stir gai_strerror getnameinfo inet_aton \ | ||||||
| 	sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \ | 	setgroups sigaction sigprocmask snprintf strdup strlcat strlcpy \ | ||||||
| 	strtok_r unsetenv waitpid]) | 	strndup strtok_r unsetenv vsnprintf waitpid]) | ||||||
|  |  | ||||||
| WORKING_GETADDRINFO | WORKING_GETADDRINFO | ||||||
|  |  | ||||||
|   | |||||||
| @@ -724,6 +724,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon) | |||||||
| 			if (real_errno != EPERM)  | 			if (real_errno != EPERM)  | ||||||
| 				goto out; | 				goto out; | ||||||
| 		} | 		} | ||||||
|  | #ifdef HAVE_SETGROUPS | ||||||
| 		if (setgroups(0, NULL) != 0) { | 		if (setgroups(0, NULL) != 0) { | ||||||
| 			real_errno = errno; | 			real_errno = errno; | ||||||
| 			Log(LOG_ERR, "Can't drop supplementary group IDs: %s!", | 			Log(LOG_ERR, "Can't drop supplementary group IDs: %s!", | ||||||
| @@ -731,6 +732,10 @@ NGIRCd_Init(bool NGIRCd_NoDaemon) | |||||||
| 			if (real_errno != EPERM) | 			if (real_errno != EPERM) | ||||||
| 				goto out; | 				goto out; | ||||||
| 		} | 		} | ||||||
|  | #else | ||||||
|  | 		Log(LOG_WARNING, | ||||||
|  | 		    "Can't drop supplementary group IDs: setgroups(3) missing!"); | ||||||
|  | #endif | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alexander Barton
					Alexander Barton