handling possible stat() error
Этот коммит содержится в:
родитель
e65803672d
Коммит
ba0dad3160
@ -1570,11 +1570,13 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
test->role == 'c'
|
||||
){
|
||||
struct stat st;
|
||||
stat(test->diskfile_name, &st);
|
||||
iperf_size_t file_bytes = st.st_size;
|
||||
test->settings->bytes = file_bytes;
|
||||
if (test->debug)
|
||||
printf("End condition set to file-size: %d bytes\n", test->settings->bytes);
|
||||
if( stat(test->diskfile_name, &st) == 0 ){
|
||||
iperf_size_t file_bytes = st.st_size;
|
||||
test->settings->bytes = file_bytes;
|
||||
if (test->debug)
|
||||
printf("End condition set to file-size: %d bytes\n", test->settings->bytes);
|
||||
}
|
||||
// if failing to read file stat, it should fallback to default duration mode
|
||||
}
|
||||
|
||||
if ((test->settings->bytes != 0 || test->settings->blocks != 0) && ! duration_flag)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user