tmpfiles: allow major or minor 0 in b and c entries

An entry for a device with a 0 in its number was skipped:

    c /dev/tty 0666 root tty - 5:0

parse_mm() took 0 to mean atoi() could not read the number.

Use atonum(), which tells the two apart.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:03:31 +01:00
1 parent adf7080fca
commit 777ecd77c8
3 files changed
+11 -19

No files matched your search

+4 -5
View File
@@ -133,11 +133,10 @@ static int parse_mm(char *arg, int *major, int *minor)
goto inval;
*ptr++ = 0;
*major = atoi(arg);
*minor = atoi(ptr);
if (!*major || !*minor)
return -1;
*major = atonum(arg);
*minor = atonum(ptr);
if (*major < 0 || *minor < 0)
goto inval;
return 0;
}