util: don't specifically check for the /dev/null major/minor, just check whether something is a char or block device

This commit is contained in:
Lennart Poettering 2010-10-08 18:22:28 +02:00
parent 6daf4f9001
commit c8f26f42e2
1 changed files with 1 additions and 4 deletions

View File

@ -3319,10 +3319,7 @@ bool null_or_empty(struct stat *st) {
if (S_ISREG(st->st_mode) && st->st_size <= 0)
return true;
/* /dev/null has major/minor of 1:3 */
if (S_ISCHR(st->st_mode) &&
major(st->st_rdev) == 1 &&
minor(st->st_rdev) == 3)
if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode))
return true;
return false;