summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/error.c b/error.c
index d9dcbe0..1e0363e 100644
--- a/error.c
+++ b/error.c
@@ -25,8 +25,13 @@ err_sprintf(buf, fmt, args)
char *buf, *fmt;
va_list args;
{
- sprintf(buf, "%s:%d: ", sourcefile, sourceline);
- vsprintf((char*)buf+strlen(buf), fmt, args);
+ if (!sourcefile) {
+ vsprintf(buf, fmt, args);
+ }
+ else {
+ sprintf(buf, "%s:%d: ", sourcefile, sourceline);
+ vsprintf((char*)buf+strlen(buf), fmt, args);
+ }
if (buf[strlen(buf)-1] != '\n')
strcat(buf, "\n");
}