Ejemplo n.º 1
0
static long parserr(B *b)
{
	P *p = pdup(b->bof, USTR "parserr");
	P *q = pdup(p, USTR "parserr");
	long nerrs = 0;

	if (b->scratch && b->name[0] == '*') {
		/* "* Build Log *", "* Grep Log *" */
	 	b->changed = 0;
	}
	freeall();
	if (errbuf != b) {
		if (errp != NULL) {
			prm(errp);
			errp = NULL;
		}
		errbuf = b;
	}
	do {
		unsigned char *s;

		pset(q, p);
		p_goto_eol(p);
		s = brvs(q, (int) (p->byte - q->byte));
		if (s) {
			nerrs += parseit(b->o.charmap, s, q->line, (b->parseone ? b->parseone : parseone));
			vsrm(s);
		}
	} while (pgetc(p) != NO_MORE_DATA);
	prm(p);
	prm(q);
	return nerrs;
}
Ejemplo n.º 2
0
int
main (int argc, char *argv[])
{
  char *vpath;
  char *emul_sources;

  if (argc > 1)
    {
      t_in = fopen (argv[1], "r");
      if (t_in == NULL)
	{
	  fprintf (stderr, "file %s doesn't exist, using stdin\n", argv[1]);
	}
    }
  if (t_in == NULL)
    {
      t_in = stdin;
    }
  determinePathOfInputFile ();
  addCh (-1);

  while (parseit ())
    {
    }

  sortSymbols ();
  dumpSymbols ();
  getEmulSourcesAndVPATH ("@srcdir@/../", &vpath, &emul_sources);
  outputSyms (vpath, emul_sources);
  free (vpath);
  free (emul_sources);
  return 0;
}
Ejemplo n.º 3
0
Archivo: mem.c Proyecto: ngoyal/openssl
/*
 * See if the current malloc should fail.
 */
static int shouldfail(void)
{
    int roll = (int)(random() % 100);
    int shoulditfail = roll < md_fail_percent;
# ifndef _WIN32
/* suppressed on Windows as POSIX-like file descriptors are non-inheritable */
    int len;
    char buff[80];

    if (md_tracefd > 0) {
        BIO_snprintf(buff, sizeof(buff),
                     "%c C%ld %%%d R%d\n",
                     shoulditfail ? '-' : '+', md_count, md_fail_percent, roll);
        len = strlen(buff);
        if (write(md_tracefd, buff, len) != len)
            perror("shouldfail write failed");
#  ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
        if (shoulditfail) {
            void *addrs[30];
            int num = backtrace(addrs, OSSL_NELEM(addrs));

            backtrace_symbols_fd(addrs, num, md_tracefd);
        }
#  endif
    }
# endif

    if (md_count) {
        /* If we used up this one, go to the next. */
        if (--md_count == 0)
            parseit();
    }

    return shoulditfail;
}
Ejemplo n.º 4
0
Archivo: mem.c Proyecto: ngoyal/openssl
void ossl_malloc_setup_failures(void)
{
    const char *cp = getenv("OPENSSL_MALLOC_FAILURES");

    if (cp != NULL && (md_failstring = strdup(cp)) != NULL)
        parseit();
    if ((cp = getenv("OPENSSL_MALLOC_FD")) != NULL)
        md_tracefd = atoi(cp);
}