Make kdc build on windows
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:
		 Asanka Herath
					Asanka Herath
				
			
				
					committed by
					
						 Love Hornquist Astrand
						Love Hornquist Astrand
					
				
			
			
				
	
			
			
			 Love Hornquist Astrand
						Love Hornquist Astrand
					
				
			
						parent
						
							caf8f87598
						
					
				
				
					commit
					b191b1e12f
				
			
							
								
								
									
										10
									
								
								kdc/main.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								kdc/main.c
									
									
									
									
									
								
							| @@ -64,6 +64,7 @@ sigterm(int sig) | ||||
| static void | ||||
| switch_environment(void) | ||||
| { | ||||
| #ifdef HAVE_GETEUID | ||||
|     if ((runas_string || chroot_string) && geteuid() != 0) | ||||
| 	errx(1, "no running as root, can't switch user/chroot"); | ||||
|  | ||||
| @@ -86,6 +87,7 @@ switch_environment(void) | ||||
| 	if (setuid(pw->pw_uid) < 0) | ||||
| 	    err(1, "setuid(%s)", runas_string); | ||||
|     } | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -120,17 +122,25 @@ main(int argc, char **argv) | ||||
|  | ||||
| 	sigaction(SIGINT, &sa, NULL); | ||||
| 	sigaction(SIGTERM, &sa, NULL); | ||||
| #ifdef SIGXCPU | ||||
| 	sigaction(SIGXCPU, &sa, NULL); | ||||
| #endif | ||||
|  | ||||
| 	sa.sa_handler = SIG_IGN; | ||||
| #ifdef SIGPIPE | ||||
| 	sigaction(SIGPIPE, &sa, NULL); | ||||
| #endif | ||||
|     } | ||||
| #else | ||||
|     signal(SIGINT, sigterm); | ||||
|     signal(SIGTERM, sigterm); | ||||
| #ifdef SIGXCPU | ||||
|     signal(SIGXCPU, sigterm); | ||||
| #endif | ||||
| #ifdef SIGPIPE | ||||
|     signal(SIGPIPE, SIG_IGN); | ||||
| #endif | ||||
| #endif | ||||
| #ifdef SUPPORT_DETACH | ||||
|     if (detach_from_console) | ||||
| 	daemon(0, 0); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user