Skip to content

Commit e78851a

Browse files
authored
Merge pull request #6704 from edgargabriel/pr/v4.0.x-empty-fileview-fix
common/ompio: fix division by zero problem with empty fview
2 parents 386ed07 + c7250cd commit e78851a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
1313
* Copyright (c) 2015-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
@@ -384,6 +384,13 @@ int mca_common_ompio_file_get_position (ompio_file_t *fh,
384384
{
385385
OMPI_MPI_OFFSET_TYPE off;
386386

387+
if ( 0 == fh->f_view_extent ||
388+
0 == fh->f_view_size ||
389+
0 == fh->f_etype_size ) {
390+
*offset = 0;
391+
return OMPI_SUCCESS;
392+
}
393+
387394
/* No. of copies of the entire file view */
388395
off = (fh->f_offset - fh->f_disp)/fh->f_view_extent;
389396

0 commit comments

Comments
 (0)