diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-02-17 20:06:04 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-02-17 20:06:18 -0500 |
commit | 974a79f0fdd6069d2e24e424a3954e2279742e85 (patch) | |
tree | 6365916e2652371029233c8e9e6e3e6f2870edba /eval.c | |
parent | beeffeb80443eec762d685e44ed287dfd2b0ce03 (diff) | |
download | bfs-974a79f0fdd6069d2e24e424a3954e2279742e85.tar.xz |
Fix an uninitialized value warning.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |