If its value can be -1, the variable should be ssize_t, not size_t.