mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
sd-path: FOREACH_LINE exorcism
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
@@ -75,7 +76,6 @@ static int from_user_dir(const char *field, char **buffer, const char **ret) {
|
||||
_cleanup_free_ char *b = NULL;
|
||||
_cleanup_free_ const char *fn = NULL;
|
||||
const char *c = NULL;
|
||||
char line[LINE_MAX];
|
||||
size_t n;
|
||||
int r;
|
||||
|
||||
@@ -103,9 +103,16 @@ static int from_user_dir(const char *field, char **buffer, const char **ret) {
|
||||
* xdg-user-dirs does upstream */
|
||||
|
||||
n = strlen(field);
|
||||
FOREACH_LINE(line, f, return -errno) {
|
||||
for (;;) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
char *l, *p, *e;
|
||||
|
||||
r = read_line(f, LONG_LINE_MAX, &line);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
l = strstrip(line);
|
||||
|
||||
if (!strneq(l, field, n))
|
||||
|
||||
Reference in New Issue
Block a user