usermod: respect --prefix for --gid option
The --gid option accepts a group name or id. When a name is provided, it
is resolved to an id by looking up the name in the group database
(/etc/group).
The --prefix option overides the location of the passwd and group
databases. I suspect the --gid option was overlooked when wiring up the
--prefix option.
useradd --gid already respects --prefix; this change makes usermod
behave the same way.
Fixes: b6b2c756c9
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Iker Pedrosa
					
				
			
			
				
	
			
			
			
						parent
						
							4c210a29bc
						
					
				
				
					commit
					bd2d0079c9
				
			@@ -1072,7 +1072,7 @@ static void process_flags (int argc, char **argv)
 | 
				
			|||||||
				fflg = true;
 | 
									fflg = true;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 'g':
 | 
								case 'g':
 | 
				
			||||||
				grp = getgr_nam_gid (optarg);
 | 
									grp = prefix_getgr_nam_gid (optarg);
 | 
				
			||||||
				if (NULL == grp) {
 | 
									if (NULL == grp) {
 | 
				
			||||||
					fprintf (stderr,
 | 
										fprintf (stderr,
 | 
				
			||||||
					         _("%s: group '%s' does not exist\n"),
 | 
										         _("%s: group '%s' does not exist\n"),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user