diff --git a/usr.bin/sort/files.c b/usr.bin/sort/files.c index b36f6945a8ce..7cb27c5385a3 100644 --- a/usr.bin/sort/files.c +++ b/usr.bin/sort/files.c @@ -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 @@ -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"); } /* diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h index 677fd452265c..d34134d4c9a3 100644 --- a/usr.bin/sort/sort.h +++ b/usr.bin/sort/sort.h @@ -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