projects
/
project
/
udebug.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
ucode: check for errors in ftruncate()
[project/udebug.git]
/
lib-ucode.c
diff --git
a/lib-ucode.c
b/lib-ucode.c
index d50fd905c716ebe2b14585194d5e079412c5b093..c2ce3b24ea0c3d9763cfa4760d334b7b9df5e04b 100644
(file)
--- a/
lib-ucode.c
+++ b/
lib-ucode.c
@@
-327,7
+327,10
@@
uc_udebug_pcap_file(uc_vm_t *vm, size_t nargs)
if (ucv_type(file) == UC_STRING) {
fd = open(ucv_string_get(file), O_WRONLY | O_CREAT, 0644);
- ftruncate(fd, 0);
+ if (ftruncate(fd, 0) < 0) {
+ close(fd);
+ return NULL;
+ }
} else if (!file)
fd = STDOUT_FILENO;