summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-17 20:06:04 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-17 20:06:18 -0500
commit974a79f0fdd6069d2e24e424a3954e2279742e85 (patch)
tree6365916e2652371029233c8e9e6e3e6f2870edba /eval.c
parentbeeffeb80443eec762d685e44ed287dfd2b0ce03 (diff)
downloadbfs-974a79f0fdd6069d2e24e424a3954e2279742e85.tar.xz
Fix an uninitialized value warning.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 6f03249..b5bef33 100644
--- a/eval.c
+++ b/eval.c
@@ -11,6 +11,7 @@
#include "bfs.h"
#include "bftw.h"
+#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -118,7 +119,7 @@ bool eval_acmtime(const struct expr *expr, struct eval_state *state) {
return false;
}
- const struct timespec *time;
+ const struct timespec *time = NULL;
switch (expr->timefield) {
case ATIME:
time = &statbuf->st_atim;
@@ -130,6 +131,7 @@ bool eval_acmtime(const struct expr *expr, struct eval_state *state) {
time = &statbuf->st_mtim;
break;
}
+ assert(time);
time_t diff = timespec_diff(&expr->reftime, time);
switch (expr->timeunit) {
@@ -153,7 +155,7 @@ bool eval_acnewer(const struct expr *expr, struct eval_state *state) {
return false;
}
- const struct timespec *time;
+ const struct timespec *time = NULL;
switch (expr->timefield) {
case ATIME:
time = &statbuf->st_atim;
@@ -165,6 +167,7 @@ bool eval_acnewer(const struct expr *expr, struct eval_state *state) {
time = &statbuf->st_mtim;
break;
}
+ assert(time);
return time->tv_sec > expr->reftime.tv_sec
|| (time->tv_sec == expr->reftime.tv_sec && time->tv_nsec > expr->reftime.tv_nsec);