diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-08-30 17:43:51 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-08-30 17:43:51 +0200 |
| commit | 57217567c66fdc728387e7222b2044a1cd0d68a6 (patch) | |
| tree | 6bc7977458af82161323c297a2d0396c86db49c1 /lib/utils/hooklib.cpp | |
| parent | f4b916d62e69bd2e6ff9690456a4a4557f449d24 (diff) | |
| download | abrt-57217567c66fdc728387e7222b2044a1cd0d68a6.tar.gz abrt-57217567c66fdc728387e7222b2044a1cd0d68a6.tar.xz abrt-57217567c66fdc728387e7222b2044a1cd0d68a6.zip | |
preparatory patch for dirsize.cpp -> dirsize.c conversion
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'lib/utils/hooklib.cpp')
| -rw-r--r-- | lib/utils/hooklib.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/utils/hooklib.cpp b/lib/utils/hooklib.cpp index 7c794ef5..f82a9ae5 100644 --- a/lib/utils/hooklib.cpp +++ b/lib/utils/hooklib.cpp @@ -118,18 +118,19 @@ void check_free_space(unsigned setting_MaxCrashReportsSize) void trim_debug_dumps(unsigned setting_MaxCrashReportsSize, const char *exclude_path) { int count = 10; - string worst_dir; while (--count >= 0) { const char *base_dirname = strrchr(exclude_path, '/') + 1; /* never NULL */ /* We exclude our own dump from candidates for deletion (3rd param): */ + char *worst_dir = NULL; double dirsize = get_dirsize_find_largest_dir(DEBUG_DUMPS_DIR, &worst_dir, base_dirname); - if (dirsize / (1024*1024) < setting_MaxCrashReportsSize || worst_dir == "") + if (dirsize / (1024*1024) < setting_MaxCrashReportsSize || !worst_dir) break; - log("size of '%s' >= %u MB, deleting '%s'", DEBUG_DUMPS_DIR, setting_MaxCrashReportsSize, worst_dir.c_str()); - char *d = concat_path_file(DEBUG_DUMPS_DIR, worst_dir.c_str()); + log("size of '%s' >= %u MB, deleting '%s'", DEBUG_DUMPS_DIR, setting_MaxCrashReportsSize, worst_dir); + char *d = concat_path_file(DEBUG_DUMPS_DIR, worst_dir); + free(worst_dir); + worst_dir = NULL; delete_debug_dump_dir(d); free(d); - worst_dir = ""; } } |
