summaryrefslogtreecommitdiff
path: root/fsmonitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'fsmonitor.c')
-rw-r--r--fsmonitor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fsmonitor.c b/fsmonitor.c
index 23f8a0c97e..ab9bfc60b3 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -185,10 +185,10 @@ static int query_fsmonitor(int version, const char *last_update, struct strbuf *
int fsmonitor_is_trivial_response(const struct strbuf *query_result)
{
static char trivial_response[3] = { '\0', '/', '\0' };
- int is_trivial = !memcmp(trivial_response,
- &query_result->buf[query_result->len - 3], 3);
- return is_trivial;
+ return query_result->len >= 3 &&
+ !memcmp(trivial_response,
+ &query_result->buf[query_result->len - 3], 3);
}
static void fsmonitor_refresh_callback(struct index_state *istate, char *name)