Skip to content

Commit 2a6c41c

Browse files
authored
Merge pull request #2574 from DennisHeimbigner/loop.dmh
Fix infinite loop in file inferencing
2 parents 0fc2c81 + a03bb5e commit 2a6c41c

10 files changed

Lines changed: 178 additions & 87 deletions

File tree

.github/workflows/run_tests_osx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name: Run macOS-based netCDF Tests
88

99

10-
on: [pull_request, workflow_dispatch]
10+
on: [pull_request,workflow_dispatch]
1111

1212
jobs:
1313

.github/workflows/run_tests_ubuntu.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
name: Run Ubuntu/Linux netCDF Tests
66

7-
on: [pull_request, workflow_dispatch]
7+
on: [pull_request,workflow_dispatch]
88

99
jobs:
1010

@@ -42,7 +42,7 @@ jobs:
4242
wget https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.15/src/hdf-4.2.15.tar.bz2
4343
tar -jxf hdf-4.2.15.tar.bz2
4444
pushd hdf-4.2.15
45-
./configure --prefix=${HOME}/environments/${{ matrix.hdf5 }} --disable-static --enable-shared --disable-fortran --disable-netcdf --with-szlib
45+
./configure --prefix=${HOME}/environments/${{ matrix.hdf5 }} --disable-static --enable-shared --disable-fortran --disable-netcdf --with-szlib --enable-hdf4-xdr
4646
make -j
4747
make install -j
4848
popd
@@ -89,7 +89,7 @@ jobs:
8989
wget https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.15/src/hdf-4.2.15.tar.bz2
9090
tar -jxf hdf-4.2.15.tar.bz2
9191
pushd hdf-4.2.15
92-
CC=mpicc ./configure --prefix=${HOME}/environments/${{ matrix.hdf5 }} --disable-static --enable-shared --disable-fortran --disable-netcdf --with-szlib --enable-parallel
92+
CC=mpicc ./configure --prefix=${HOME}/environments/${{ matrix.hdf5 }} --disable-static --enable-shared --disable-fortran --disable-netcdf --with-szlib --enable-parallel --enable-hdf4-xdr
9393
make -j
9494
make install -j
9595
popd

.github/workflows/run_tests_win_cygwin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Run Cygwin-based tests
22

3-
on: [pull_request, workflow_dispatch]
3+
on: [pull_request,workflow_dispatch]
44

55
env:
66
SHELLOPTS: igncr

.github/workflows/run_tests_win_mingw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: Run MSYS2, MinGW64-based Tests
99
env:
1010
CPPFLAGS: "-D_BSD_SOURCE"
1111

12-
on: [pull_request, workflow_dispatch]
12+
on: [pull_request,workflow_dispatch]
1313

1414
jobs:
1515

libdispatch/dfile.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,19 +1839,16 @@ NC_create(const char *path0, int cmode, size_t initialsz,
18391839

18401840
TRACE(nc_create);
18411841
if(path0 == NULL)
1842-
return NC_EINVAL;
1842+
{stat = NC_EINVAL; goto done;}
18431843

18441844
/* Check mode flag for sanity. */
1845-
if ((stat = check_create_mode(cmode)))
1846-
return stat;
1845+
if ((stat = check_create_mode(cmode))) goto done;
18471846

18481847
/* Initialize the library. The available dispatch tables
18491848
* will depend on how netCDF was built
18501849
* (with/without netCDF-4, DAP, CDMREMOTE). */
1851-
if(!NC_initialized)
1852-
{
1853-
if ((stat = nc_initialize()))
1854-
return stat;
1850+
if(!NC_initialized) {
1851+
if ((stat = nc_initialize())) goto done;
18551852
}
18561853

18571854
{
@@ -1863,10 +1860,7 @@ NC_create(const char *path0, int cmode, size_t initialsz,
18631860

18641861
memset(&model,0,sizeof(model));
18651862
newpath = NULL;
1866-
if((stat = NC_infermodel(path,&cmode,1,useparallel,NULL,&model,&newpath))) {
1867-
nullfree(newpath);
1868-
goto done;
1869-
}
1863+
if((stat = NC_infermodel(path,&cmode,1,useparallel,NULL,&model,&newpath))) goto done;
18701864
if(newpath) {
18711865
nullfree(path);
18721866
path = newpath;
@@ -1918,7 +1912,7 @@ NC_create(const char *path0, int cmode, size_t initialsz,
19181912
dispatcher = NC3_dispatch_table;
19191913
break;
19201914
default:
1921-
return NC_ENOTNC;
1915+
{stat = NC_ENOTNC; goto done;}
19221916
}
19231917

19241918
/* Create the NC* instance and insert its dispatcher and model */
@@ -1937,6 +1931,7 @@ NC_create(const char *path0, int cmode, size_t initialsz,
19371931
}
19381932
done:
19391933
nullfree(path);
1934+
nullfree(newpath);
19401935
return stat;
19411936
}
19421937

@@ -1980,12 +1975,12 @@ NC_open(const char *path0, int omode, int basepe, size_t *chunksizehintp,
19801975
TRACE(nc_open);
19811976
if(!NC_initialized) {
19821977
stat = nc_initialize();
1983-
if(stat) return stat;
1978+
if(stat) goto done;
19841979
}
19851980

19861981
/* Check inputs. */
19871982
if (!path0)
1988-
return NC_EINVAL;
1983+
{stat = NC_EINVAL; goto done;}
19891984

19901985
/* Capture the inmemory related flags */
19911986
mmap = ((omode & NC_MMAP) == NC_MMAP);

0 commit comments

Comments
 (0)