This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/8874: using rdbuf to copy from an empty file sets the fail bit on the target stream
- From: nick dot wells at jobstats dot co dot uk
- To: gcc-gnats at gcc dot gnu dot org
- Date: 8 Dec 2002 15:47:06 -0000
- Subject: libstdc++/8874: using rdbuf to copy from an empty file sets the fail bit on the target stream
- Reply-to: nick dot wells at jobstats dot co dot uk
>Number: 8874
>Category: libstdc++
>Synopsis: using rdbuf to copy from an empty file sets the fail bit on the target stream
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Dec 08 07:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Nick Wells
>Release: gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
Linux RedHat 8.0 i686 (Dell Precision 220)
>Description:
when you copy from an empty file using the os << fs.rdbuf() idiom the failbit is set on the output stream. See sample code.
>How-To-Repeat:
compile and run the program (I have used /etc/passwd as a 'good' file and /dev/null as a 'bad' file but any file would do.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="rdbuf.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="rdbuf.C"
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4K
CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKdm9pZCBmKG9zdHJlYW0gJiB0bywgY29uc3QgY2hhciAq
IGNvbnN0IGZpbGVuYW1lKQp7CiAgICBpZnN0cmVhbSBmcm9tKGZpbGVuYW1lKTsKICAgIGlmICgh
IGZyb20pCWNlcnIgPDwgImNhbid0IG9wZW4gIiA8PCBmaWxlbmFtZSA8PCBlbmRsOwogICAgZWxz
ZQoJdG8gPDwgZnJvbS5yZGJ1ZigpIDw8IGVuZGw7CgogICAgY2VyciA8PCAiZnJvbSA9ICIgPDwg
ZmlsZW5hbWUgPDwgZW5kbDsKICAgIGNlcnIgPDwgInRvLmJhZGJpdCA9ICIgPDwgdG8uYmFkKCkg
PDwgIiwgdG8uZW9mYml0ID0gIiA8PCB0by5lb2YoKSA8PCAiLCB0by5mYWlsYml0ID0gIiA8PCB0
by5mYWlsKCkgPDwgZW5kbDsKICAgIGNlcnIgPDwgImZyb20uYmFkYml0ID0gIiA8PCBmcm9tLmJh
ZCgpIDw8ICIsIGZyb20uZW9mYml0ID0gIiA8PCBmcm9tLmVvZigpIDw8ICIsIGZyb20uZmFpbGJp
dCA9ICIgPDwgZnJvbS5mYWlsKCkgPDwgZW5kbDsKfQoKbWFpbihpbnQgYXJnYywgY2hhciAqKiBh
cmd2KQp7CiAgICBvZnN0cmVhbSB0bygiLi90ZXN0LnJkYnVmLm91dCIpOwogICAgCiAgICBmKHRv
LCAiL2V0Yy9wYXNzd2QiKTsKICAgIGYodG8sICIvZGV2L251bGwiKTsKfQo=