diff --git a/tools/hcidump.1 b/tools/hcidump.1
index d9bd7c2..913471c 100644
--- a/tools/hcidump.1
+++ b/tools/hcidump.1
.TP
.BR -Y ", " "\-\^\-novendor"
Don't display any vendor commands or events and don't show any pin code or link key in plain text.
+.TP
+.BR -N ", " "\-\^\-noappend"
+No appending to existing files. Always create new files.
.SH FILTERS
.B
filter
diff --git a/tools/hcidump.c b/tools/hcidump.c
index f330e28..f1d0825 100644
--- a/tools/hcidump.c
+++ b/tools/hcidump.c
static int defcompid = DEFAULT_COMPID;
static int mode = PARSE;
static int permcheck = 1;
+static int noappend = 0;
static long flags;
static long filter;
static char *dump_file = NULL;
int fd, len, open_flags;
if (mode == WRITE || mode == PPPDUMP || mode == AUDIO) {
- if (flags & DUMP_BTSNOOP)
- open_flags = O_WRONLY | O_CREAT;
+ if (noappend || flags & DUMP_BTSNOOP)
+ open_flags = O_WRONLY | O_CREAT | O_TRUNC;
else
open_flags = O_WRONLY | O_CREAT | O_APPEND;
} else
" -B, --btsnoop Use BTSnoop file format\n"
" -V, --verbose Verbose decoding\n"
" -Y, --novendor No vendor commands or events\n"
+ " -N, --noappend No appending to existing files\n"
" -h, --help Give this help list\n"
" --usage Give a short usage message\n"
);
{ "verbose", 0, 0, 'V' },
{ "novendor", 0, 0, 'Y' },
{ "nopermcheck", 0, 0, 'Z' },
+ { "noappend", 0, 0, 'N' },
{ "help", 0, 0, 'h' },
{ 0 }
};
printf("HCI sniffer - Bluetooth packet analyzer ver %s\n", VERSION);
- while ((opt=getopt_long(argc, argv, "i:l:p:m:w:r:s:n:taxXRC:H:O:P:D:A:BVYZh", main_options, NULL)) != -1) {
+ while ((opt=getopt_long(argc, argv, "i:l:p:m:w:r:s:n:taxXRC:H:O:P:D:A:BVYZNh", main_options, NULL)) != -1) {
switch(opt) {
case 'i':
if (strcasecmp(optarg, "none") && strcasecmp(optarg, "system"))
permcheck = 0;
break;
+ case 'N':
+ noappend = 1;
+ break;
+
case 'h':
default:
usage();