Re: [PATCH] Use SEEK_SET/SEEK_CUR symbols instead of ints when calling l
From:
Andrew Oates
Subject:
Re: [PATCH] Use SEEK_SET/SEEK_CUR symbols instead of ints when calling lseek()
Date:
Tue, 11 Nov 2025 16:17:05 -0500
Sounds good, thanks. Combined a couple and send two more as well, for
three total. Let me know if these look reasonable to you
On Tue, Nov 11, 2025 at 1:38 PM Andrew Oates <andrew@andrewoates.com> wrote:
> I have a series of additional small fixes like this --- if these are
> acceptable, would you prefer I send them as separate logical patches, or
> bundle them up into one combo patch?
>
> On Tue, Nov 11, 2025 at 9:21 AM <andrew@andrewoates.com> wrote:
>
>> From: Andrew Oates <andrew@andrewoates.com>
>>
>> ---
>> lib/termcap/termcap.c | 2 +-
>> shell.c | 4 ++--
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/termcap/termcap.c b/lib/termcap/termcap.c
>> index 2b47062e..a18af160 100644
>> --- a/lib/termcap/termcap.c
>> +++ b/lib/termcap/termcap.c
>> @@ -611,7 +611,7 @@ scan_file (char *str, int fd, struct buffer *bufp)
>> bufp->ateof = 0;
>> *bufp->ptr = '\0';
>>
>> - lseek (fd, 0L, 0);
>> + lseek (fd, 0L, SEEK_SET);
>>
>> while (!bufp->ateof)
>> {
>> diff --git a/shell.c b/shell.c
>> index 8e595d33..6ea54fde 100644
>> --- a/shell.c
>> +++ b/shell.c
>> @@ -1654,7 +1654,7 @@ open_shell_script (char *script_name)
>> #endif
>>
>> /* Only do this with non-tty file descriptors we can seek on. */
>> - if (fd_is_tty == 0 && (lseek (fd, 0L, 1) != -1))
>> + if (fd_is_tty == 0 && (lseek (fd, 0L, SEEK_CUR) != -1))
>> {
>> /* Check to see if the `file' in `bash file' is a binary file
>> according to the same tests done by execute_simple_command (),
>> @@ -1691,7 +1691,7 @@ open_shell_script (char *script_name)
>> exit (EX_BINARY_FILE);
>> }
>> /* Now rewind the file back to the beginning. */
>> - lseek (fd, 0L, 0);
>> + lseek (fd, 0L, SEEK_SET);
>> }
>>
>> /* Open the script. But try to move the file descriptor to a randomly
>> --
>> 2.51.2
>>
>>