Check against errors when reading trace device. CID 4561.
This commit is contained in:
parent
70a37300e4
commit
584065ec56
@ -35,7 +35,7 @@
|
|||||||
* trace.c - print traces of D (B) channel activity for isdn4bsd
|
* trace.c - print traces of D (B) channel activity for isdn4bsd
|
||||||
* -------------------------------------------------------------
|
* -------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* $Id: trace.c,v 1.8 2004/03/28 20:49:22 pooka Exp $
|
* $Id: trace.c,v 1.9 2007/09/08 15:34:23 pooka Exp $
|
||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*
|
*
|
||||||
@ -393,13 +393,20 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (Popt == 0)
|
if (Popt == 0)
|
||||||
{
|
{
|
||||||
|
char buffer[80];
|
||||||
n = read(f, buf, BSIZE);
|
n = read(f, buf, BSIZE);
|
||||||
|
if (n == -1)
|
||||||
|
{
|
||||||
|
snprintf(buffer, sizeof(buffer),
|
||||||
|
"Error reading trace device");
|
||||||
|
perror(buffer);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (Bopt)
|
if (Bopt)
|
||||||
{
|
{
|
||||||
if ((fwrite(buf, 1, n, BP)) != n)
|
if ((fwrite(buf, 1, n, BP)) != n)
|
||||||
{
|
{
|
||||||
char buffer[80];
|
|
||||||
snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
"Error writing file [%s]",
|
"Error writing file [%s]",
|
||||||
rBPfilename);
|
rBPfilename);
|
||||||
|
Loading…
Reference in New Issue
Block a user