freebsd-src/lib/libfigpar
Faraz Vahedi f144058b40 Refactor error handling in lseek operations
1. Subtraction was performed on the current position
   regardless of the success of the lseek operation.
   In the event of an error, this resulted in the
   current position being erroneously set to -2,
   which bypassed the intended error handling
   mechanism. The proposed change performs error
   checking immediately following the lseek operation,
   prior to any modification of the current position.
   This ensures that a failed lseek operation will
   correctly trigger the appropriate error handling.

2. The error checking logic was based on the assumption
   that lseek would return `offset - 1` upon failure.
   However, this is not consistent with the behaviour of
   lseek as specified in the POSIX standard, which
   stipulates that lseek shall return -1 in case of
   an error. The code has been updated to reflect this
   standard, improving reliability and compliance.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1392
2024-09-21 05:25:15 -06:00
..
figpar.3
figpar.c Refactor error handling in lseek operations 2024-09-21 05:25:15 -06:00
figpar.h
Makefile
Makefile.depend
string_m.c Remove unused includes, migrate to stdint.h for uintXX_t types. 2024-09-21 05:25:15 -06:00
string_m.h