1
1

handling possible stat() error

Этот коммит содержится в:
Hamid Anvari 2021-07-07 16:23:47 -06:00 коммит произвёл Bruce A. Mah
родитель 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)