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

Improved fix for sys_nerr

From: Pete Forman <gsez020(at)kryten(dot)bedford(dot)waii(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Improved fix for sys_nerr
Date: 2000-10-26 09:25:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
                        POSTGRESQL BUG REPORT TEMPLATE

Your name		:	Pete Forman
Your email address	:       pete(dot)forman(at)westgeo(dot)com

System Configuration
  Architecture (example: Intel Pentium)  	: Intel Pentium II

  Operating System (example: Linux 2.0.26 ELF) 	: Cygwin B20.1 and others

  PostgreSQL version (example: PostgreSQL-7.1):   PostgreSQL-7.1

  Compiler used (example:  gcc 2.8.0)		: egcs-2.91.57

Please enter a FULL description of your problem:

Files backend/utils/error/elog.c and exc.c had errors building on
Cygwin B20.1 (and BeOS so I'm told).  The current source (elog.c,v
1.64, exc.c,v 1.31) is fixed for Cygwin 1.1 and BeOS but not very
robustly.  This patch works on the systems and versions I've tested.
Others were tested by subscribers to PORTS.

The changes made are:

   1) Remove declarations of "extern int errno;".
      - errno does not have to be an int, it may be a macro.  In
        threaded code it almost certainly will be the latter.
        <errno.h> will already have the correct declaration.

   2) Remove sys_nerr and _sys_nerr.
      - These are not portable, e.g. older Cygwin and BeOS.
        In any case the test errno < sys_nerr assumes that valid
        errnos are contiguous.  strerror() may go wrong on holes.

   3) Test both errno and the return of strerror() to see if it fails.
      - This works an all(?) OSs except HPUX and QNX.  These then have
        a minor limitation that if the elog() is called with an out of
        range errno then its number will not be printed.  I would
        expect that it would be called with a valid errno.
        In exc.c both the errno and its message, if available, are now
        I leave it to the user to call elog(..., "%d: %m", errno, ...)
        if they want to guarantee a number.
        Anything more complicated will need to involve configure.  I
        am loathe to do so because this sort of error code is called
        infrequently and will only be tested lightly.  Keep it

    4) Remove any OS specific clauses: ifdef __CYGWIN__ or __BEOS__.

I have posted an equivalent patch to PORTS for 7.0.2.

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible: 

If you know how this problem might be fixed, list the solution below:


pgsql-patches by date

Next:From: Peter EisentrautDate: 2000-10-26 14:59:20
Subject: Re: readline and openbsd
Previous:From: Bruce MomjianDate: 2000-10-26 06:16:27
Subject: Re: minor doc patchu

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