Since both sfi and sfo refer to the same underlying descriptor it is a bad idea to fclose() both of them. In this case, it is not a big deal as sfo has already been flushed. There's really no need for two streams so I committed a change to use a single one, opened with "r+", and added the fclose().
- todd