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 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
figpar.c Refactor error handling in lseek operations 2024-09-21 05:25:15 -06:00
figpar.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
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 Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00