diff options
author | yxliang01 <13267.okk@gmail.com> | 2018-04-29 05:51:35 -0700 |
---|---|---|
committer | MartinNowack <martin.nowack@gmail.com> | 2018-05-07 10:04:53 +0100 |
commit | fcffe19529007d065b0b729d12c7941f7a4112c6 (patch) | |
tree | e7b22615b6d8be1d6d727321627c36cb701343b1 /runtime | |
parent | 6a7b21b8f84035c262c2bc566a3dc35d44517d33 (diff) | |
download | klee-fcffe19529007d065b0b729d12c7941f7a4112c6.tar.gz |
Fixed utimes() behavior for symbolic files when the second argument is NULL
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/POSIX/fd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/POSIX/fd.c b/runtime/POSIX/fd.c index e0e87604..84d0bdc5 100644 --- a/runtime/POSIX/fd.c +++ b/runtime/POSIX/fd.c @@ -28,6 +28,7 @@ #include <termios.h> #include <sys/select.h> #include <klee/klee.h> +#include <sys/time.h> /* Returns pointer to the symbolic file structure fs the pathname is symbolic */ static exe_disk_file_t *__get_sym_file(const char *pathname) { @@ -246,6 +247,14 @@ int utimes(const char *path, const struct timeval times[2]) { exe_disk_file_t *dfile = __get_sym_file(path); if (dfile) { + + if (!times) { + struct timeval newTimes[2]; + gettimeofday(&(newTimes[0]), NULL); + newTimes[1] = newTimes[0]; + times = newTimes; + } + /* don't bother with usecs */ dfile->stat->st_atime = times[0].tv_sec; dfile->stat->st_mtime = times[1].tv_sec; |