projects
/
project
/
udebug.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c7ef98d
)
lib-ucode: truncate pcap files
author
Felix Fietkau
<nbd@nbd.name>
Mon, 4 Dec 2023 18:56:14 +0000
(19:56 +0100)
committer
Felix Fietkau
<nbd@nbd.name>
Mon, 4 Dec 2023 18:56:16 +0000
(19:56 +0100)
avoid keeping stale data
Signed-off-by: Felix Fietkau <nbd@nbd.name>
lib-ucode.c
patch
|
blob
|
history
diff --git
a/lib-ucode.c
b/lib-ucode.c
index 8e042e3f99f36b8b4f97b2eae0ae0a3a573259d1..d50fd905c716ebe2b14585194d5e079412c5b093 100644
(file)
--- a/
lib-ucode.c
+++ b/
lib-ucode.c
@@
-325,9
+325,10
@@
uc_udebug_pcap_file(uc_vm_t *vm, size_t nargs)
uc_value_t *args = uc_fn_arg(1);
int fd = -1;
- if (ucv_type(file) == UC_STRING)
+ if (ucv_type(file) == UC_STRING)
{
fd = open(ucv_string_get(file), O_WRONLY | O_CREAT, 0644);
- else if (!file)
+ ftruncate(fd, 0);
+ } else if (!file)
fd = STDOUT_FILENO;
return uc_debug_pcap_init(fd, args);