Patchwork [libfortran] Fix PR 30162, write with pipes

login
register
mail settings
Submitter Thomas Koenig
Date Dec. 15, 2012, 12:44 p.m.
Message ID <50CC7091.4020104@netcologne.de>
Download mbox | patch
Permalink /patch/206615/
State New
Headers show

Comments

Thomas Koenig - Dec. 15, 2012, 12:44 p.m.
Hi Janus,

Oops, right.  Here is the correct one.

Regards

	Thomas

> wrong patch attached? It contains a hunk in frontend-passes.c, which
> seems totally unrelated ...
>
> Cheers,
> Janus
>
>
>
> 2012/12/15 Thomas Koenig <tkoenig@netcologne.de>:
>> Hello world,
>>
>> the attached patch fixes the regression and regtests cleanly.
>> No test case because I could not find anything portable
>> to create a FIFO in the testsuite.
>>
>> OK for trunk and 4.7?
>>
>>          Thomas
>>
>> 2012-12-15  Thomas Koenig  <tkoenig@gcc.gnu.org>
>>
>>          PR libfortran/30162
>>          * io/unix.c (raw_tell):  If the lseek is done on a
>>          non-seekable file, return 0.
>>
>
Thomas Koenig - Dec. 20, 2012, 11:23 a.m.
Ping?

	Thomas

> Hi Janus,
>
> Oops, right.  Here is the correct one.
>
> Regards
>
>      Thomas
>
>> wrong patch attached? It contains a hunk in frontend-passes.c, which
>> seems totally unrelated ...
>>
>> Cheers,
>> Janus
>>
>>
>>
>> 2012/12/15 Thomas Koenig <tkoenig@netcologne.de>:
>>> Hello world,
>>>
>>> the attached patch fixes the regression and regtests cleanly.
>>> No test case because I could not find anything portable
>>> to create a FIFO in the testsuite.
>>>
>>> OK for trunk and 4.7?
>>>
>>>          Thomas
>>>
>>> 2012-12-15  Thomas Koenig  <tkoenig@gcc.gnu.org>
>>>
>>>          PR libfortran/30162
>>>          * io/unix.c (raw_tell):  If the lseek is done on a
>>>          non-seekable file, return 0.
>>>
>>
>
jerry DeLisle - Dec. 21, 2012, 8:40 p.m.
On 12/20/2012 03:23 AM, Thomas Koenig wrote:
> Ping?
>
>      Thomas
>
>> Hi Janus,
>>
>> Oops, right.  Here is the correct one.
>>
Yes, OK

Regards,

Jerry

Patch

Index: io/unix.c
===================================================================
--- io/unix.c	(Revision 194507)
+++ io/unix.c	(Arbeitskopie)
@@ -344,7 +344,15 @@ 
 static gfc_offset
 raw_tell (unix_stream * s)
 {
-  return lseek (s->fd, 0, SEEK_CUR);
+  gfc_offset x;
+  x = lseek (s->fd, 0, SEEK_CUR);
+
+  /* Non-seekable files should always be assumed to be at
+     current position.  */
+  if (x == -1 && errno == ESPIPE)
+    x = 0;
+
+  return x;
 }
 
 static gfc_offset