Revert upstreams chfn.c strsep change

Closes: #1096187
This commit is contained in:
Chris Hofstaedtler
2025-02-17 12:28:14 +01:00
parent f476e8b263
commit a143aca1c9
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Mon, 17 Feb 2025 12:26:07 +0100
Subject: Partially revert "lib/, src/: Use strsep(3) instead of its pattern"
This reverts src/chfn.c from commit 16cb664865541162c504a6f5ef5ca4b38b5e0c9a.
---
src/chfn.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/chfn.c b/src/chfn.c
index 4c96fba..f06cb44 100644
--- a/src/chfn.c
+++ b/src/chfn.c
@@ -216,27 +216,32 @@ static void new_fields (void)
*/
static char *copy_field (char *in, char *out, char *extra)
{
- while (NULL != in) {
- char *f;
+ char *cp = NULL;
- f = strsep(&in, ",");
+ while (NULL != in) {
+ cp = strchr (in, ',');
+ if (NULL != cp) {
+ *cp++ = '\0';
+ }
- if (strchr(f, '=') == NULL)
+ if (strchr (in, '=') == NULL) {
break;
+ }
if (NULL != extra) {
if (!streq(extra, "")) {
strcat (extra, ",");
}
- strcat(extra, f);
+ strcat (extra, in);
}
+ in = cp;
}
if ((NULL != in) && (NULL != out)) {
strcpy (out, in);
}
- return in;
+ return cp;
}
/*

View File

@@ -10,3 +10,4 @@ upstream/a015e919834c90b99947829c6c823f7fe93a8097-E_BAD_NAME.patch
upstream/man-useradd.8.xml-Document-new-exit-code-19-E_BAD_NAME.patch
upstream/Revert-lib-src-Use-local-time-for-human-readable-dates.patch
Revert-lib-strtoday.c-strtoday-Fix-calculation.patch
Partially-revert-lib-src-Use-strsep-3-instead-of-its-patt.patch