summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/shadow/shadow-4.0.18.2-useradd-fix-1.patch
blob: d35580dcfacde5636c89e61474bca5eec8c0ecab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# DIY Linux Patch
Date: 2007-11-08
Author: Greg Schafer <gschafer@zip.com.au>
Origin: Modelled on the same upstream fix for usermod.
Maker: Greg Schafer <gschafer@zip.com.au>
Upstream Status: Submitted, applied.
Description: Fix -g problems in useradd.

diff -Naur shadow-4.0.18.2.orig/src/useradd.c shadow-4.0.18.2/src/useradd.c
--- shadow-4.0.18.2.orig/src/useradd.c	2007-10-07 14:36:51.000000000 +0000
+++ shadow-4.0.18.2/src/useradd.c	2007-11-08 06:33:32.433004367 +0000
@@ -204,12 +204,8 @@
 	char *errptr;
 
 	gid = strtol (grname, &errptr, 10);
-	if (*errptr || errno == ERANGE || gid < 0) {
-		fprintf (stderr,
-			 _("%s: invalid numeric argument '%s'\n"), Prog,
-			 grname);
-		exit (E_BAD_ARG);
-	}
+	if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0)
+		return getgrgid (gid);
 	return getgrnam (grname);
 }