diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-10-29 02:15:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-10-29 02:15:22 +0000 |
commit | 0802e8e9866571ee1e221da106418d6268f1f1ea (patch) | |
tree | bcd50710b74407082d1234033e067ed0ed943e34 | |
parent | fb9e735cd7930718024a6d1a0b297e3ff8506a76 (diff) |
use correct ioctl for flushing; garath@code.ridgefield.org
-rw-r--r-- | usr.sbin/ipmon/ipmon.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/ipmon/ipmon.c b/usr.sbin/ipmon/ipmon.c index f0164fc2e5c..b8a33689b63 100644 --- a/usr.sbin/ipmon/ipmon.c +++ b/usr.sbin/ipmon/ipmon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmon.c,v 1.14 1998/09/17 03:43:45 pattonme Exp $ +/* $OpenBSD: ipmon.c,v 1.15 1998/10/29 02:15:21 deraadt Exp $ * Copyright (C) 1993-1997 by Darren Reed. * * Redistribution and use in source and binary forms are permitted @@ -7,7 +7,7 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)ipmon.c 1.21 6/5/96 (C)1993-1997 Darren Reed"; -static const char rcsid[] = "@(#)$Id: ipmon.c,v 1.14 1998/09/17 03:43:45 pattonme Exp $"; +static const char rcsid[] = "@(#)$Id: ipmon.c,v 1.15 1998/10/29 02:15:21 deraadt Exp $"; #endif #include <stdio.h> @@ -642,14 +642,19 @@ static void flushlogs(file, log) char *file; FILE *log; { - int fd, flushed = 0; + int fd, cmd, flushed = 0; + + if (strcmp(file, "/dev/ipstate") == 0) + cmd = SIOCIPFFL; + else + cmd = SIOCIPFFB; if ((fd = open(file, O_RDWR)) == -1) { (void) fprintf(stderr, "%s: open: %s\n", file,STRERROR(errno)); exit(-1); } - if (ioctl(fd, SIOCIPFFB, &flushed) == 0) { + if (ioctl(fd, cmd, &flushed) == 0) { printf("%d bytes flushed from log buffer\n", flushed); fflush(stdout); |