HDFGroup / vol-async

Asynchronous I/O for HDF5
https://hdf5-vol-async.readthedocs.io
Other
19 stars 13 forks source link

Checks for < 0 of unsigned variables. #14

Closed brtnfld closed 2 years ago

brtnfld commented 2 years ago

One of many checks do this comparision:

if ((attempt_count = check_app_acquire_mutex(task, &mutex_count, &acquired)) < 0) goto done;

is a no-op because attempt_count is an unsigned int. This if condition can be removed.

houjun commented 2 years ago

@brtnfld If you look at check_app_acquire_mutex function, there are cases when it returns -1, e.g. lines 2984, 2995, etc. So the check should be there.

brtnfld commented 2 years ago

Should not _attemptcount be an 'int' instead if it can be negative?

houjun commented 2 years ago

OK, I see the problem, just pushed a fix