From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wen Yi <896634148@qq.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Why can't lseek the STDIN_FILENO?
Date: Fri, 23 Jun 2023 22:40:05 -0400
Message-ID: <123007.1687574405@sss.pgh.pa.us> (raw)
In-Reply-To: <tencent_BD37EEC28D51FACFA5B1EE6995C274087205@qq.com>
References: <tencent_BD37EEC28D51FACFA5B1EE6995C274087205@qq.com>
"=?gb18030?B?V2VuIFlp?=" <896634148@qq.com> writes:
> lseek(STDIN_FILENO, 0, SEEK_SET);
If you are not checking for failure return from a system call,
you are in a state of sin.
> I really don't know, why the buffer's content not be "Hello world\n"?
Probably because a tty input device is not seekable.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, 896634148@qq.com
Subject: Re: Why can't lseek the STDIN_FILENO?
In-Reply-To: <123007.1687574405@sss.pgh.pa.us>
References: <tencent_BD37EEC28D51FACFA5B1EE6995C274087205@qq.com> <123007.1687574405@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox