chiark / gitweb /
bus: StartTransientUnit can have aux unit
[elogind.git] / src / journal / journal-vacuum.c
index d141fe0ffb57800095704fee6b0e37dede6f7e5e..49734098488a7ddaa27aa206749bd3a41e045aff 100644 (file)
@@ -275,7 +275,7 @@ int journal_directory_vacuum(
                                 log_full(verbose ? LOG_INFO : LOG_DEBUG, "Deleted empty archived journal %s/%s (%s).", directory, p, format_bytes(sbytes, sizeof(sbytes), size));
                                 freed += size;
                         } else if (errno != ENOENT)
-                                log_warning("Failed to delete empty archived journal %s/%s: %m", directory, p);
+                                log_warning_errno(errno, "Failed to delete empty archived journal %s/%s: %m", directory, p);
 
                         free(p);
                         continue;
@@ -283,7 +283,11 @@ int journal_directory_vacuum(
 
                 patch_realtime(directory, p, &st, &realtime);
 
-                GREEDY_REALLOC(list, n_allocated, n_list + 1);
+                if (!GREEDY_REALLOC(list, n_allocated, n_list + 1)) {
+                        free(p);
+                        r = -ENOMEM;
+                        goto finish;
+                }
 
                 list[n_list].filename = p;
                 list[n_list].usage = 512UL * (uint64_t) st.st_blocks;
@@ -314,7 +318,7 @@ int journal_directory_vacuum(
                                 sum = 0;
 
                 } else if (errno != ENOENT)
-                        log_warning("Failed to delete archived journal %s/%s: %m", directory, list[i].filename);
+                        log_warning_errno(errno, "Failed to delete archived journal %s/%s: %m", directory, list[i].filename);
         }
 
         if (oldest_usec && i < n_list && (*oldest_usec == 0 || list[i].realtime < *oldest_usec))