From 4aa1b5b40e14b6173d576fa22563ebd393561296 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 23 Jan 2020 14:14:49 +0100 Subject: [PATCH] LibC: The pwd and grp related functions need to preserve empty fieldso Now that String::split() defaults to keep_empty=false, we need to make sure the pwd and grp functions in LibC keep the empty ones. This fixes "id" moaning about invalid lines in /etc/group. --- Libraries/LibC/grp.cpp | 2 +- Libraries/LibC/pwd.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibC/grp.cpp b/Libraries/LibC/grp.cpp index c00f38897d..21d4a73650 100644 --- a/Libraries/LibC/grp.cpp +++ b/Libraries/LibC/grp.cpp @@ -113,7 +113,7 @@ next_entry: if (feof(__grdb_stream)) return nullptr; String line(s, Chomp); - auto parts = line.split(':'); + auto parts = line.split(':', true); if (parts.size() != 4) { fprintf(stderr, "getgrent(): Malformed entry on line %u: '%s' has %u parts\n", __grdb_line_number, line.characters(), parts.size()); goto next_entry; diff --git a/Libraries/LibC/pwd.cpp b/Libraries/LibC/pwd.cpp index 9665323667..f12c90ca5f 100644 --- a/Libraries/LibC/pwd.cpp +++ b/Libraries/LibC/pwd.cpp @@ -114,7 +114,7 @@ next_entry: if (feof(__pwdb_stream)) return nullptr; String line(s, Chomp); - auto parts = line.split(':'); + auto parts = line.split(':', true); if (parts.size() != 7) { fprintf(stderr, "getpwent(): Malformed entry on line %u\n", __pwdb_line_number); goto next_entry;