Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory - Mailing list pgsql-general

From Ian Lance Taylor
Subject Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory
Date
Msg-id siitirke2r.fsf@daffy.airs.com
Whole thread Raw
In response to Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Chris Jones <chris@mt.sri.com> writes:
> > If write didn't return -1, it shouldn't have set errno.  A short write
> > count isn't an error condition.
>
> On disk files it certainly is; there's no non-error reason to do that,
> and AFAICS no reason for the application to try again.

Probably true, but on Unix you certainly can't assume that write will
set errno if it does not return -1.  On Linux systems, for example,
this does not happen.  As Chris says, Posix only promises to set errno
if there is an error indication.  The only error indication for write
is a return of -1.

A portable way to check whether errno was set would be to do something
like
    errno = 0;
    if (write(...) != ...)
    {
        if (errno == 0)
            error("unexpected short write--disk full?")
        else
            error("write failed: %s", strerror(errno));
    }

Ian

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory
Next
From: "Denis A. Doroshenko"
Date:
Subject: Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory