X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fconf-parser.c;h=3ccd1c067a20c13b0aa085fa8d9a4093af3d6a63;hb=4ff77f66af8bd3e7e403c81febb7a2471457c5da;hp=3bb430e375183499889243ee9ef14169e141123a;hpb=44d91056924e1e64699892f71121b40c46489e57;p=elogind.git diff --git a/src/conf-parser.c b/src/conf-parser.c index 3bb430e37..3ccd1c067 100644 --- a/src/conf-parser.c +++ b/src/conf-parser.c @@ -314,7 +314,7 @@ int config_parse( continuation = c; else { continuation = strdup(l); - if (!c) { + if (!continuation) { r = -ENOMEM; goto finish; } @@ -752,3 +752,30 @@ int config_parse_mode( *m = (mode_t) l; return 0; } + +int config_parse_bytes( + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + off_t *bytes = data; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + assert_cc(sizeof(off_t) == sizeof(uint64_t)); + + if (parse_bytes(rvalue, bytes) < 0) { + log_error("[%s:%u] Failed to parse bytes value, ignoring: %s", filename, line, rvalue); + return 0; + } + + return 0; +}