Shachar Shemesh wrote on Sun, Jul 29, 2012 at 06:35:18 +0300:
On 07/29/2012 02:12 AM, Daniel Shahaf wrote:
So if the disk hardware fails after close() returns but before the OS
caches are flushed...
It is not part of close(2)'s job description to protect against this
scenario. If you
On 07/27/2012 02:52 PM, Elazar Leibovich wrote:
(as mentioned earlier, the no space left could just as well happen
after the file was closed, so I don't mind that much it's not reported
on a close())
Ehm, no.
First of all, please note a subtle but important difference between your
question
BTW - everyone here keeps assuming that close(2) is called on disk files,
what about other types of file descriptors (sockets, pipes, character and
block devices, virtual filesystem files)? How would you adjust your
answers for that case?
On 28 July 2012 16:56, Shachar Shemesh shac...@shemesh.biz
Shachar Shemesh wrote on Sat, Jul 28, 2012 at 09:56:40 +0300:
On 07/27/2012 02:52 PM, Elazar Leibovich wrote:
(as mentioned earlier, the no space left could just as well happen
after the file was closed, so I don't mind that much it's not reported
on a close())
Ehm, no.
First of
On 07/29/2012 02:12 AM, Daniel Shahaf wrote:
So if the disk hardware fails after close() returns but before the OS
caches are flushed...
It is not part of close(2)'s job description to protect against this
scenario. If you want to protect against this scenario, use sync(2).
Shachar
--
My practical answer:
I always check fclose() . It happened to me that it returned errors when
the file I was trying to close was already closed (which usually meant I
had a bug, because I closed one file twice, another never. It also failed
with no space left on device, when it was trying to
Thanks!
You nailed it! closing a file twice is an error that makes sense to be
issued at close. So simple, how could I miss it?
(as mentioned earlier, the no space left could just as well happen after
the file was closed, so I don't mind that much it's not reported on a
close())
On Fri, Jul 27,
On Fri, Jul 27, 2012 at 2:52 PM, Elazar Leibovich elaz...@gmail.com wrote:
Thanks!
You nailed it! closing a file twice is an error that makes sense to be
issued at close. So simple, how could I miss it?
(as mentioned earlier, the no space left could just as well happen after
the file was
On Fri, Jul 27, 2012 at 2:52 PM, Elazar Leibovich elaz...@gmail.com wrote:
You nailed it! closing a file twice is an error that makes sense to be
issued at close. So simple, how could I miss it?
Not only for catching your bugs. If fclose(3) returns an error any
further access to the
On Fri, Jul 27, 2012 at 7:06 PM, Oleg Goldshmidt p...@goldshmidt.org wrote:
On Fri, Jul 27, 2012 at 2:52 PM, Elazar Leibovich elaz...@gmail.com wrote:
You nailed it! closing a file twice is an error that makes sense to be
issued at close. So simple, how could I miss it?
Not only for
This might not really be helpful to know, the file descriptor is left in an
unspecified state according to POSIX, see:
http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
The fact that POSIX does not specify the fd's state is, indeed, not
helpful. The *reason* why it does not specify it is
On Fri, Jul 27, 2012, Elazar Leibovich wrote about Re: What's the practical
use of the error close() returns?:
You nailed it! closing a file twice is an error that makes sense to be
issued at close. So simple, how could I miss it?
Yes, that's a good reason - nice catch. I also didn't think
I was always intrigued by this unix tidbit, closing a file can return an
error. In practice, it is rarely checked (as far as I've seen)
What does it mean? If I understand it correctly, recent write can lie about
its success.
But when do you really need it? If you have a piece of information you
On Thu, Jul 26, 2012, Elazar Leibovich wrote about What's the practical use of
the error close() returns?:
I was always intrigued by this unix tidbit, closing a file can return an
error. In practice, it is rarely checked (as far as I've seen)
Here are my two cents:
In Unix/Linux, writing
On Fri, Jul 27, 2012 at 12:12 AM, Nadav Har'El n...@math.technion.ac.ilwrote:
So it seems to me that checking the close() only *sometimes* lets you
know of write errors which you'll otherwise miss. But since you'll
anyway miss other write errors (those coming after the close()), it's
not
15 matches
Mail list logo