diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c index 5e902dd71..fb379f76f 100644 --- a/libsrc4/nc4var.c +++ b/libsrc4/nc4var.c @@ -977,18 +977,12 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate, /* Find info for this file and group, and set pointer to each. */ if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) return retval; + assert(nc && grp && h5); #ifdef USE_HDF4 ishdf4 = h5->hdf4; #endif - /* Attempting to do any of these things on a netCDF-3 file produces - * an error. */ - if (!h5) - return NC_ENOTNC4; - - assert(nc && grp && h5); - /* Find the var. */ if (varid < 0 || varid >= grp->vars.nelems) return NC_ENOTVAR; diff --git a/nc_test4/tst_vars2.c b/nc_test4/tst_vars2.c index 82313f427..e7577e75c 100644 --- a/nc_test4/tst_vars2.c +++ b/nc_test4/tst_vars2.c @@ -751,7 +751,11 @@ main(int argc, char **argv) /* Define the variable. */ if (nc_def_var(ncid, VAR_NAME5, NC_INT, NDIMS5, dimids, &varid)) ERR; - /* This will fail due to bad chunk size. */ + /* These will fail due to bad parameters. */ + if (nc_def_var_chunking(ncid + MILLION, varid, NC_CHUNKED, + chunksize) != NC_EBADID) ERR; + if (nc_def_var_chunking(ncid + TEST_VAL_42, varid, NC_CHUNKED, + chunksize) != NC_EBADID) ERR; if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, bad_chunksize) != NC_EBADCHUNK) ERR;