summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/H5O.c b/src/H5O.c
index ff4e5a3..0ef5b43 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1299,7 +1299,8 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
/* adjust link count */
if(adjust < 0) {
- if(oh->nlink + adjust < 0)
+ /* Check for too large of an adjustment */
+ if((unsigned)(-adjust) > oh->nlink)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
oh->nlink += adjust;
oh_flags |= H5AC__DIRTIED_FLAG;