* Clean up error messages in killUser().
This commit is contained in:
		
							parent
							
								
									74299c1cfb
								
							
						
					
					
						commit
						141294ff38
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		|  | @ -810,7 +810,8 @@ void killUser(uid_t uid) | ||||||
|     case 0: |     case 0: | ||||||
|         try { /* child */ |         try { /* child */ | ||||||
| 
 | 
 | ||||||
|             if (setuid(uid) == -1) abort(); |             if (setuid(uid) == -1) | ||||||
|  |                 throw SysError("setting uid"); | ||||||
| 
 | 
 | ||||||
| 	    while (true) { | 	    while (true) { | ||||||
| 		if (kill(-1, SIGKILL) == 0) break; | 		if (kill(-1, SIGKILL) == 0) break; | ||||||
|  | @ -820,7 +821,7 @@ void killUser(uid_t uid) | ||||||
| 	    } | 	    } | ||||||
| 
 | 
 | ||||||
|         } catch (std::exception & e) { |         } catch (std::exception & e) { | ||||||
|             std::cerr << format("killing processes beloging to uid `%1%': %1%") |             std::cerr << format("killing processes belonging to uid `%1%': %2%") | ||||||
|                 % uid % e.what() << std::endl; |                 % uid % e.what() << std::endl; | ||||||
|             quickExit(1); |             quickExit(1); | ||||||
|         } |         } | ||||||
|  | @ -828,8 +829,9 @@ void killUser(uid_t uid) | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     /* parent */ |     /* parent */ | ||||||
|     if (pid.wait(true) != 0) |     int status = pid.wait(true); | ||||||
|         throw Error(format("cannot kill processes for uid `%1%'") % uid); |     if (status != 0) | ||||||
|  |         throw Error(format("cannot kill processes for uid `%1%': %2%") % uid % statusToString(status)); | ||||||
| 
 | 
 | ||||||
|     /* !!! We should really do some check to make sure that there are
 |     /* !!! We should really do some check to make sure that there are
 | ||||||
|        no processes left running under `uid', but there is no portable |        no processes left running under `uid', but there is no portable | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue