summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-12-26 06:30:37 +0100
committerStefan Kangas <stefan@marxist.se>2021-12-26 06:30:37 +0100
commit4e2058aec33db5097edd17da8fe08bea373fd8bc (patch)
treead2fade110167fd88fd3f666da013e3fe7974c8a /src
parentbb666073d34369606a1f446bb0f79dba388cb564 (diff)
parent89a82182cbca0caa19f5b9463629918b7131ef0c (diff)
Merge from origin/emacs-28
89a82182cb Improve documentation of read-multiple-choice 5fccd1e371 Explain why we remove stuff from 'user-full-name'
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 5c9c34dc352..6ba09cceec4 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1233,7 +1233,11 @@ return "unknown".
If optional argument UID is an integer, return the full name
of the user with that uid, or nil if there is no such user.
If UID is a string, return the full name of the user with that login
-name, or nil if there is no such user. */)
+name, or nil if there is no such user.
+
+If the full name includes commas, remove everything starting with
+the first comma, because the \\='gecos\\=' field of the \\='/etc/passwd\\=' file
+is in general a comma-separated list. */)
(Lisp_Object uid)
{
struct passwd *pw;
@@ -1263,7 +1267,8 @@ name, or nil if there is no such user. */)
return Qnil;
p = USER_FULL_NAME;
- /* Chop off everything after the first comma. */
+ /* Chop off everything after the first comma, since 'pw_gecos' is a
+ comma-separated list. */
q = strchr (p, ',');
full = make_string (p, q ? q - p : strlen (p));