chiark / gitweb /
journald: fix calculation of disk space
[elogind.git] / src / journal / journald.c
index e9ac897de7fd37793f5fa654274ebf5ed65e063b..ee270e79af8a24b25912d6fafee7d8b48c9595c5 100644 (file)
@@ -171,7 +171,10 @@ static uint64_t available_space(Server *s) {
                 if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
                         continue;
 
-                sum += (uint64_t) st.st_blocks * (uint64_t) st.st_blksize;
+                if (!S_ISREG(st.st_mode))
+                        continue;
+
+                sum += (uint64_t) st.st_blocks * 512UL;
         }
 
         avail = sum >= m->max_use ? 0 : m->max_use - sum;
@@ -308,8 +311,6 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
                 return s->system_journal;
 
         server_fix_perms(s, f, uid);
-        f->metrics = s->system_metrics;
-        f->compress = s->compress;
 
         r = hashmap_put(s->user_journals, UINT32_TO_PTR(uid), f);
         if (r < 0) {