chiark / gitweb /
util: don't specifically check for the /dev/null major/minor, just check whether...
[elogind.git] / src / util.c
index 85ee09d1422ed33cca8bec09e8fb4774cbf9ed30..d09e44777671b298f02eac2f1f7beea3152e1891 100644 (file)
@@ -3313,6 +3313,18 @@ void freeze(void) {
                 pause();
 }
 
+bool null_or_empty(struct stat *st) {
+        assert(st);
+
+        if (S_ISREG(st->st_mode) && st->st_size <= 0)
+                return true;
+
+        if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode))
+                return true;
+
+        return false;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",