about summary refs log tree commit diff
path: root/src/afl-common.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-09-04 22:48:46 +0200
committerGitHub <noreply@github.com>2020-09-04 22:48:46 +0200
commit4f7a8a4c70de1b93b1dccd8f2bf092ec4b3626dc (patch)
tree8c81a16ba76661b0df5307b9964275ff529d4deb /src/afl-common.c
parent7f621509eee57f0b6fd9ad542adc4f2acafeb059 (diff)
parent976ee9022cda95e0715b82ff866098ad293117c9 (diff)
downloadafl++-4f7a8a4c70de1b93b1dccd8f2bf092ec4b3626dc.tar.gz
Merge pull request #542 from AFLplusplus/dev
push to stable
Diffstat (limited to 'src/afl-common.c')
-rw-r--r--src/afl-common.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 367dec72..d66440aa 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -877,3 +877,36 @@ u32 get_map_size(void) {
 
 }
 
+/* Create a stream file */
+
+FILE *create_ffile(u8 *fn) {
+
+  s32   fd;
+  FILE *f;
+
+  fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+  if (fd < 0) { PFATAL("Unable to create '%s'", fn); }
+
+  f = fdopen(fd, "w");
+
+  if (!f) { PFATAL("fdopen() failed"); }
+
+  return f;
+
+}
+
+/* Create a file */
+
+s32 create_file(u8 *fn) {
+
+  s32 fd;
+
+  fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+  if (fd < 0) { PFATAL("Unable to create '%s'", fn); }
+
+  return fd;
+
+}
+