diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-06-29 12:01:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-29 20:03:56 +0100 |
commit | 3a47c40d97ddafe5e9ffd76be2c31a3072e064dd (patch) | |
tree | c7756e64a210a0fa60541d3827feb083359531ba /src/tmpfiles | |
parent | 61e0111df98f1c98b48902634a0612210419e11f (diff) | |
download | systemd-3a47c40d97ddafe5e9ffd76be2c31a3072e064dd.tar.gz systemd-3a47c40d97ddafe5e9ffd76be2c31a3072e064dd.tar.bz2 systemd-3a47c40d97ddafe5e9ffd76be2c31a3072e064dd.zip |
tree-wide: port various parts of the code to use parse_dev()
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index eeeb1d1850..ed81c49d08 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2636,24 +2636,21 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool break; case CREATE_CHAR_DEVICE: - case CREATE_BLOCK_DEVICE: { - unsigned major, minor; - + case CREATE_BLOCK_DEVICE: if (!i.argument) { *invalid_config = true; log_error("[%s:%u] Device file requires argument.", fname, line); return -EBADMSG; } - if (sscanf(i.argument, "%u:%u", &major, &minor) != 2) { + r = parse_dev(i.argument, &i.major_minor); + if (r < 0) { *invalid_config = true; - log_error("[%s:%u] Can't parse device file major/minor '%s'.", fname, line, i.argument); + log_error_errno(r, "[%s:%u] Can't parse device file major/minor '%s'.", fname, line, i.argument); return -EBADMSG; } - i.major_minor = makedev(major, minor); break; - } case SET_XATTR: case RECURSIVE_SET_XATTR: |