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 e12214b300..fb8d789740 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -184,10 +184,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)