From: | Ian Lance Taylor <ian(at)airs(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Chris Jones <chris(at)mt(dot)sri(dot)com>, Oliver Elphick <olly(at)lfix(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory |
Date: | 2001-05-23 20:25:32 |
Message-ID: | siitirke2r.fsf@daffy.airs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Chris Jones <chris(at)mt(dot)sri(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Mercer | 2001-05-23 20:33:32 | Re: $PGSQL/include/postgres.h |
Previous Message | Tom Lane | 2001-05-23 20:05:40 | Re: $PGSQL/include/postgres.h |