correct error code for operation not allowed in data mode is NC_ENOTINDEFINE

This commit is contained in:
Wei-keng Liao 2018-08-24 21:26:25 -05:00
parent c59f43d604
commit 116f303182
2 changed files with 4 additions and 4 deletions

View File

@ -403,7 +403,7 @@ NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
if (!(h5->flags & NC_INDEF))
{
if (h5->cmode & NC_CLASSIC_MODEL)
return NC_EINDEFINE;
return NC_ENOTINDEFINE;
if ((retval = NC4_redef(ncid)))
BAIL(retval);
}
@ -417,7 +417,7 @@ NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
len * nc4typelen(file_type) > (size_t)att->len * nc4typelen(att->nc_typeid))
{
if (h5->cmode & NC_CLASSIC_MODEL)
return NC_EINDEFINE;
return NC_ENOTINDEFINE;
if ((retval = NC4_redef(ncid)))
BAIL(retval);
}

View File

@ -178,12 +178,12 @@ main(int argc, char **argv)
/* Try and write a new att. Won't work. */
if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, strlen(CONTENTS_2),
CONTENTS_2) != NC_EINDEFINE) ERR;
CONTENTS_2) != NC_ENOTINDEFINE) ERR;
/* This will not work. Overwriting att must be same length or
* shorter if not in define mode. */
if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS_2),
CONTENTS_2) != NC_EINDEFINE) ERR;
CONTENTS_2) != NC_ENOTINDEFINE) ERR;
/* Now overwrite the att. */
if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS_3),