bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug] close() returns "0" when closing unopened files


From: Seb
Subject: [bug] close() returns "0" when closing unopened files
Date: Wed, 3 Dec 2008 19:03:35 +0100

Hello,

I think this time the bug come from gawk (3.1.6). :)

As a matter of fact, the standard says that close() returns 0 when it succeeds
and another value otherwise.

Theorically, this code, where getline() can't open the file so that
close() can't close it, should not return "0":

$ rm -f /tmp/none
$ gawk 'BEGIN {f="/tmp/none"; while((getline v < f) > 0){break}; print close
(f)}'
0

I tested with nawk and mawk, both chose to return "-1" in this case.

++
Seb.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]