mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 10:34:38 +02:00
8153073: UL: Set filesize option with k/m/g
Reviewed-by: mlarsson, dholmes
This commit is contained in:
parent
e24c1e8bbd
commit
e41ab59d63
5 changed files with 17 additions and 13 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "logging/logConfiguration.hpp"
|
||||
#include "logging/logFileOutput.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/os.inline.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
|
@ -187,14 +188,15 @@ bool LogFileOutput::parse_options(const char* options, outputStream* errstream)
|
|||
}
|
||||
_file_count = static_cast<uint>(value);
|
||||
} else if (strcmp(FileSizeOptionKey, key) == 0) {
|
||||
size_t value = parse_value(value_str);
|
||||
if (value == SIZE_MAX || value > SIZE_MAX / K) {
|
||||
julong value;
|
||||
success = Arguments::atojulong(value_str, &value);
|
||||
if (!success || (value > SIZE_MAX)) {
|
||||
errstream->print_cr("Invalid option: %s must be in range [0, "
|
||||
SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX / K);
|
||||
SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX);
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
_rotate_size = value * K;
|
||||
_rotate_size = static_cast<size_t>(value);
|
||||
} else {
|
||||
errstream->print_cr("Invalid option '%s' for log file output.", key);
|
||||
success = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue