Browse Source

fix regression in getspnam[_r] error code for insufficient buffer size

commit 2d7d05f031e014068a61d3076c6178513395d2ae wrongly changed ERANGE
to EINVAL, likely as the result of copy-and-paste error.
Rich Felker 7 years ago
parent
commit
91d34c4533
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/passwd/getspnam_r.c

+ 1 - 1
src/passwd/getspnam_r.c

@@ -76,7 +76,7 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
 
 	/* Buffer size must at least be able to hold name, plus some.. */
 	if (size < l+100)
-		return errno = EINVAL;
+		return errno = ERANGE;
 
 	/* Protect against truncation */
 	if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)