Skip to content

Commit a77e149

Browse files
committed
check nelems > 0 to silence compilation warnings
1 parent 94ce438 commit a77e149

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/drivers/ncmpio/ncmpio_header_put.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ hdr_put_NC_attr(bufferinfo *pbp,
220220
status = ncmpix_put_uint64((void**)(&pbp->pos), (uint64)attrp->nelems);
221221
if (status != NC_NOERR) return status;
222222

223-
/* copy [values ...] */
224-
status = hdr_put_NC_attrV(pbp, attrp);
225-
if (status != NC_NOERR) return status;
223+
if (attrp->nelems > 0) { /* attribute is allowed to be of size zero */
224+
/* copy [values ...] */
225+
status = hdr_put_NC_attrV(pbp, attrp);
226+
if (status != NC_NOERR) return status;
227+
}
226228

227229
return NC_NOERR;
228230
}

0 commit comments

Comments
 (0)