chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dbc4fba
)
journal: fix potential integer overflow
author
Lennart Poettering
<lennart@poettering.net>
Wed, 17 Oct 2012 19:23:52 +0000
(21:23 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 17 Oct 2012 19:25:42 +0000
(21:25 +0200)
src/journal/journal-vacuum.c
patch
|
blob
|
history
diff --git
a/src/journal/journal-vacuum.c
b/src/journal/journal-vacuum.c
index 22c9cfcd526a02e78574e304ff20f8a95a0fcf1e..731f6c770f8938ae9982ea7573eed70d9f00a976 100644
(file)
--- a/
src/journal/journal-vacuum.c
+++ b/
src/journal/journal-vacuum.c
@@
-243,6
+243,7
@@
int journal_directory_vacuum(
have_seqnum = false;
} else
+ /* We do not vacuum active files or unknown files! */
continue;
patch_realtime(directory, de->d_name, &st, &realtime);
@@
-291,7
+292,12
@@
int journal_directory_vacuum(
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
- sum -= list[i].usage;
+
+ if ((uint64_t) list[i].usage > sum)
+ sum -= list[i].usage;
+ else
+ sum = 0;
+
} else if (errno != ENOENT)
log_warning("Failed to delete %s/%s: %m", directory, list[i].filename);
}