X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=lib-ucode.c;h=d50fd905c716ebe2b14585194d5e079412c5b093;hb=e259bbd49cf7b074a2ade5e62351e4e8f5fd76aa;hp=8e042e3f99f36b8b4f97b2eae0ae0a3a573259d1;hpb=c7ef98d3d3f715ad2cea80b9d67b2c058209a545;p=project%2Fudebug.git diff --git a/lib-ucode.c b/lib-ucode.c index 8e042e3..d50fd90 100644 --- 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);