#include "check_error.h"
+/* FIXME: including a colon at the end is a bad way to indicate an error */
void eprintf (const char *fmt, const char *file, int line, ...)
{
va_list args;
void *p;
p = malloc(n);
if (p == NULL)
- eprintf("malloc of %u bytes failed:", __FILE__, __LINE__, n);
+ eprintf("malloc of %u bytes failed:", __FILE__, __LINE__ - 2, n);
return p;
}
void *p;
p = realloc (ptr, n);
if (p == NULL)
- eprintf("realloc of %u bytes failed:", __FILE__, __LINE__, n);
+ eprintf("realloc of %u bytes failed:", __FILE__, __LINE__ - 2, n);
return p;
}
if (srunner_has_log (sr)) {
f = fopen(sr->log_fname, "w");
if (f == NULL)
- eprintf ("Could not open log file %s:", __FILE__, __LINE__,
+ eprintf ("Error in call to fopen while opening log file %s:", __FILE__, __LINE__ - 2,
sr->log_fname);
}
return f;
if (srunner_has_xml (sr)) {
f = fopen(sr->xml_fname, "w");
if (f == NULL)
- eprintf ("Could not open xml file %s:", __FILE__, __LINE__,
+ eprintf ("Error in call to fopen while opening xml file %s:", __FILE__, __LINE__ - 2,
sr->xml_fname);
}
return f;
if (lg->close) {
rval = fclose (lg->lfile);
if (rval != 0)
- eprintf ("Error closing log file:", __FILE__, __LINE__);
+ eprintf ("Error in call to fclose while closing log file:", __FILE__, __LINE__ - 2);
}
free (lg);
}
fp = get_pipe();
if (fp == NULL)
- eprintf ("Couldn't find pipe",__FILE__, __LINE__);
+ eprintf ("Error in call to get_pipe",__FILE__, __LINE__ - 2);
rewind(fp);
rmsg = punpack (fileno(fp));
teardown_pipe();
n = pack (type, &buf, msg);
r = write (fdes, buf, n);
if (r == -1)
- eprintf ("Error in ppack:",__FILE__,__LINE__);
+ eprintf ("Error in call to write:", __FILE__, __LINE__ - 2);
free (buf);
}
if (n == 0)
break;
if (n == -1)
- eprintf ("Error in read_buf:", __FILE__, __LINE__);
+ eprintf ("Error in call to read:", __FILE__, __LINE__ - 4);
nread += n;
size *= grow;
n = upack (buf, &msg, &type);
if (n == -1)
- eprintf ("Error in upack", __FILE__, __LINE__);
+ eprintf ("Error in call to upack", __FILE__, __LINE__ - 2);
if (type == CK_MSG_CTX) {
CtxMsg *cmsg = (CtxMsg *) &msg;
int status = 0;
pid = fork();
if (pid == -1)
- eprintf("Unable to fork:",__FILE__,__LINE__);
+ eprintf("Error in call to fork:", __FILE__, __LINE__ - 2);
if (pid == 0) {
setpgid(0, 0);
group_pid = getpgrp();