add a description about what was being attempted to failed writes messages.

This commit is contained in:
mrg 2015-08-05 07:10:03 +00:00
parent b8ce913648
commit 366296f5a8
2 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: files.c,v 1.41 2009/11/06 18:34:22 joerg Exp $ */
/* $NetBSD: files.c,v 1.42 2015/08/05 07:10:03 mrg Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
#include "sort.h"
#include "fsort.h"
__RCSID("$NetBSD: files.c,v 1.41 2009/11/06 18:34:22 joerg Exp $");
__RCSID("$NetBSD: files.c,v 1.42 2015/08/05 07:10:03 mrg Exp $");
#include <string.h>
@ -226,7 +226,8 @@ seq(FILE *fp, u_char **line)
void
putrec(const RECHEADER *rec, FILE *fp)
{
EWRITE(rec, 1, REC_ROUNDUP(offsetof(RECHEADER, data) + rec->length), fp);
EWRITE(rec, 1, REC_ROUNDUP(offsetof(RECHEADER, data) + rec->length), fp,
"failed to write temp file");
}
/*
@ -235,7 +236,8 @@ putrec(const RECHEADER *rec, FILE *fp)
void
putline(const RECHEADER *rec, FILE *fp)
{
EWRITE(rec->data+rec->offset, 1, rec->length - rec->offset, fp);
EWRITE(rec->data+rec->offset, 1, rec->length - rec->offset, fp,
"failed to write");
}
/*
@ -244,7 +246,8 @@ putline(const RECHEADER *rec, FILE *fp)
void
putkeydump(const RECHEADER *rec, FILE *fp)
{
EWRITE(rec, 1, REC_ROUNDUP(offsetof(RECHEADER, data) + rec->offset), fp);
EWRITE(rec, 1, REC_ROUNDUP(offsetof(RECHEADER, data) + rec->offset), fp,
"failed to write debug key");
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: sort.h,v 1.34 2011/09/16 15:39:29 joerg Exp $ */
/* $NetBSD: sort.h,v 1.35 2015/08/05 07:10:03 mrg Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@ -100,9 +100,9 @@
err(2, "%p", file); \
}
#define EWRITE(ptr, size, n, f) { \
#define EWRITE(ptr, size, n, f, fmt) { \
if (!fwrite(ptr, size, n, f)) \
err(2, NULL); \
err(2, fmt); \
}
/* Records are limited to MAXBUFSIZE (8MB) and less if you want to sort