diff options
author | daurnimator <quae@daurnimator.com> | 2015-03-09 15:11:44 -0400 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-03-10 16:08:20 +0100 |
commit | 657cf7f4f8d376e082db48022d2be193ff647d06 (patch) | |
tree | 9adaa444c2e5d4d359ac02c4d93310b732d45526 /src/tmpfiles/tmpfiles.c | |
parent | cb81cd8073392936882643af0129934bf67e96c4 (diff) |
tmpfiles: port to unquote_many_words()
Diffstat (limited to 'src/tmpfiles/tmpfiles.c')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 652fe5f229..10c5a63dbf 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1506,23 +1506,25 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { _cleanup_(item_free_contents) Item i = {}; ItemArray *existing; Hashmap *h; - int r, c = -1, pos; + int r, pos; bool force = false, boot = false; assert(fname); assert(line >= 1); assert(buffer); - r = sscanf(buffer, - "%ms %ms %ms %ms %ms %ms %n", + r = unquote_many_words(&buffer, &action, &path, &mode, &user, &group, &age, - &c); - if (r < 2) { + &i.argument, + NULL); + if (r < 0) + return log_error_errno(r, "[%s:%u] Failed to parse line: %m", fname, line); + else if (r < 2) { log_error("[%s:%u] Syntax error.", fname, line); return -EIO; } @@ -1559,15 +1561,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { return r; } - if (c >= 0) { - c += strspn(buffer+c, WHITESPACE); - if (buffer[c] != 0 && (buffer[c] != '-' || buffer[c+1] != 0)) { - i.argument = unquote(buffer+c, "\""); - if (!i.argument) - return log_oom(); - } - } - switch (i.type) { case CREATE_FILE: |