Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Re: pg_dump return status..

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Matthew <matt(at)ctlno(dot)com>, "'Anand Raman'" <araman(at)india-today(dot)com>, postgresql <pgsql-general(at)postgresql(dot)org>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Re: pg_dump return status..
Date: 2001-01-05 16:20:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackers
Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> There are a few places to check, but a lot less than before. Assuming I
> should just die on any failed write (which seems reasonable),

Yes, I see no point in continuing after a write failure.  Just print
the strerror() message and exit.

> how do I
> check for a failed write in a way that works on all Unixes? Is the
> following OK:

> - fwrite: ok if return value equals item count
> - fprintf: ok if return value > 0.
> - fputc: ok if != EOF

Probably fprintf() >= 0 --- according to my specs, it returns the number
of chars emitted, or a negative value on error.  The other two are

Don't forget to check for a successful fclose() too, since otherwise
you won't notice a failure in dumping the last bufferload of data.

I do not recall the success/failure return codes for the zlib calls,
but I assume they check for write failure and reflect it back ...

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Alex PilosovDate: 2001-01-05 18:50:18
Subject: Re: running pgsql 7 under Jail'ed virtual machine on FreeBSD 4.2
Previous:From: Dave VanAukenDate: 2001-01-05 14:11:13
Subject: RE: running pgsql 7 under Jail'ed virtual machine on FreeBSD 4.2

pgsql-general by date

Next:From: Scott ShealyDate: 2001-01-05 16:27:48
Subject: ODBC failure
Previous:From: nelsonDate: 2001-01-05 15:33:39
Subject: Re: Max connections

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group