about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2019-08-13 20:47:27 +0100
committerMartinNowack <martin.nowack@gmail.com>2019-08-14 16:26:48 +0100
commit23767d2dba13dc1dd0022f77577f2adddf38279a (patch)
tree75bf2a25ed4795fba0f6eb4a4b97c74beec7eb70
parentdc414fde33f3ec22a6ae3cf29cfc6bc4a9ddae1a (diff)
downloadklee-23767d2dba13dc1dd0022f77577f2adddf38279a.tar.gz
Delete functions delete_file() and delete_dir() which are not needed now that klee-replay creates a temporary directory for replay
-rw-r--r--tools/klee-replay/file-creator.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/tools/klee-replay/file-creator.c b/tools/klee-replay/file-creator.c
index 9b6e66a8..a41e02e2 100644
--- a/tools/klee-replay/file-creator.c
+++ b/tools/klee-replay/file-creator.c
@@ -41,7 +41,6 @@ static void create_file(int target_fd,
                        exe_disk_file_t *dfile,
                        const char *tmpdir);
 static void check_file(int index, exe_disk_file_t *dfile);
-static void delete_file(const char *path, int recurse);
 
 
 #define __STDIN (-1)
@@ -327,44 +326,6 @@ static int create_reg_file(const char *fname, exe_disk_file_t *dfile,
   return fd;
 }
 
-static int delete_dir(const char *path, int recurse) {
-  if (recurse) {
-    DIR *d = opendir(path);
-    struct dirent *de;
-
-    if (d) {
-      while ((de = readdir(d))) {
-        if (strcmp(de->d_name, ".") != 0 && strcmp(de->d_name, "..") != 0) {
-          char tmp[PATH_MAX];
-          snprintf(tmp, sizeof(tmp), "%s/%s", path, de->d_name);
-          delete_file(tmp, 0);
-        }
-      }
-
-      closedir(d);
-    }
-  }
-
-  if (rmdir(path) == -1) {
-    fprintf(stderr, "KLEE-REPLAY: ERROR: Cannot create file %s (exists, is dir, can't remove)\n", path);
-    perror("rmdir");
-    return -1;
-  }
-
-  return 0;
-}
-
-static void delete_file(const char *path, int recurse) {
-  if (unlink(path) < 0 && errno != ENOENT) {
-    if (errno == EISDIR) {
-      delete_dir(path, 1);
-    } else {
-      fprintf(stderr, "KLEE-REPLAY: ERROR: Cannot create file %s (already exists)\n", path);
-      perror("unlink");
-    }
-  }
-}
-
 static void create_file(int target_fd,
                         const char *target_name,
                         exe_disk_file_t *dfile,
@@ -382,8 +343,6 @@ static void create_file(int target_fd,
 
   target = tmpname;
 
-  delete_file(target, 1);
-
   // XXX get rid of me once a reasonable solution is found
   s->st_uid = geteuid();
   s->st_gid = getegid();