Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qCtCB-0007Oz-UR for pgsql-general@arkaria.postgresql.org; Sat, 24 Jun 2023 02:40:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qCtCA-00072d-Iz for pgsql-general@arkaria.postgresql.org; Sat, 24 Jun 2023 02:40:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qCtCA-00072U-88 for pgsql-general@lists.postgresql.org; Sat, 24 Jun 2023 02:40:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qCtC3-0008DU-Pt for pgsql-general@lists.postgresql.org; Sat, 24 Jun 2023 02:40:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 35O2e5lu123008; Fri, 23 Jun 2023 22:40:06 -0400 From: Tom Lane To: "=?gb18030?B?V2VuIFlp?=" <896634148@qq.com> cc: "=?gb18030?B?cGdzcWwtZ2VuZXJhbA==?=" Subject: Re: Why can't lseek the STDIN_FILENO? In-reply-to: References: Comments: In-reply-to "=?gb18030?B?V2VuIFlp?=" <896634148@qq.com> message dated "Sat, 24 Jun 2023 10:16:41 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <123006.1687574405.1@sss.pgh.pa.us> Date: Fri, 23 Jun 2023 22:40:05 -0400 Message-ID: <123007.1687574405@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "=?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