Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set truncation file handle check from < 0 to == -1
This patch replaces the `CS%[uv]_file < 0` checks with `CS%[uv]_file == -1`. FMS1 returns negative file handles for missing or otherwise error-prone files, but the FMS2 IO framework relies on `newunit=` to autogenerate handle IDs, which are always negative and cannot be used with checks for negative values. The check is replaced with equality with -1. `newunit` is guaranteed to never return -1 for a valid file, so this is a valid check for a missing file. It also lets us continue to use -1 as the initial (unopened) value. Behavior is compatible with `mpp_open()` output, so this can also be used with the FMS1 API. A better solution would be to introduce some validation function which is defined by each API, but there is not yet any need for such sophistication.
- Loading branch information