pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: error.c,v 1.112 2003/07/30 19:05:37 mast Exp $ + || $Id: error.c,v 1.113 2003/08/04 16:14:21 mast Exp $   */      #define NO_PIKE_SHORTHAND   #include "global.h"   #include "svalue.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "interpret.h"   #include "stralloc.h"   #include "builtin_functions.h"   #include "array.h"   #include "object.h"   #include "main.h"   #include "builtin_functions.h"   #include "backend.h"   #include "operators.h"   #include "module_support.h"   #include "threads.h"   #include "gc.h"    - RCSID("$Id: error.c,v 1.112 2003/07/30 19:05:37 mast Exp $"); + RCSID("$Id: error.c,v 1.113 2003/08/04 16:14:21 mast Exp $");      #undef ATTRIBUTE   #define ATTRIBUTE(X)      PMOD_EXPORT const char msg_fatal_error[] =    "%s:%d: Fatal error:\n";   #ifdef PIKE_DEBUG   PMOD_EXPORT const char msg_unsetjmp_nosync_1[] =    "UNSETJMP out of sync! (last SETJMP at %s)!\n";   PMOD_EXPORT const char msg_unsetjmp_nosync_2[] =
pike.git/src/error.c:204:    char buf[4096];    SWAP_IN_THREAD_IF_REQUIRED();    if(in_error)    {    const char *tmp=in_error;    in_error=0;    Pike_fatal("Recursive error() calls, original error: %s",tmp);    }       in_error=buf; +  VSNPRINTF (buf, sizeof (buf), fmt, args);    - #ifdef HAVE_VSNPRINTF -  vsnprintf(buf, 4090, fmt, args); - #else /* !HAVE_VSNPRINTF */ -  VSPRINTF(buf, fmt, args); - #endif /* HAVE_VSNPRINTF */ -  +     if(!Pike_interpreter.recoveries)    {   #ifdef PIKE_DEBUG    if (d_flag) {    fprintf(stderr,"No error recovery context!\n%s",buf);    dump_backlog();    }   #endif       fprintf(stderr,"No error recovery context!\n%s",buf);    exit(99);    }    -  if((size_t)strlen(buf) >= (size_t)sizeof(buf)) -  Pike_fatal("Buffer overflow in error()\n"); -  +     low_error(buf);   }      PMOD_EXPORT DECLSPEC(noreturn) void new_error(const char *name, const char *text, struct svalue *oldsp,    INT32 args, const char *file, int line) ATTRIBUTE((noreturn))   {    int i;       ASSERT_THREAD_SWAPPED_IN();   
pike.git/src/error.c:659:   DECLSPEC(noreturn) void generic_error_va(struct object *o,    const char *func,    struct svalue *base_sp, int args,    const char *fmt,    va_list foo)    ATTRIBUTE((noreturn))   {    char buf[8192];    int i;    - #ifdef HAVE_VSNPRINTF -  vsnprintf(buf, sizeof(buf)-1, fmt, foo); - #else /* !HAVE_VSNPRINTF */ -  /* Sentinel that will be overwritten on buffer overflow. */ -  buf[sizeof(buf)-1] = '\0'; +  VSNPRINTF(buf, sizeof(buf), fmt, foo);    -  VSPRINTF(buf, fmt, foo); -  -  if(buf[sizeof(buf)-1]) -  Pike_fatal("Buffer overflow in error()\n"); - #endif /* HAVE_VSNPRINTF */ -  +     if(in_error)    {    const char *tmp=in_error;    in_error=0;    Pike_fatal("Recursive error() calls, original error: %s",tmp);    }    in_error=buf;      #if 0    if (!master_program) {