소스 검색

Fix an always-false check with an assertion

In validate_recommended_package_line, at this point in the function,
n_entries is always >= 1.  Coverity doesn't like us checking it for
0.

CID 1268063.
Nick Mathewson 8 년 전
부모
커밋
f4ded2cdc9
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      src/or/dirserv.c

+ 3 - 1
src/or/dirserv.c

@@ -3745,7 +3745,9 @@ validate_recommended_package_line(const char *line)
     cp = end_of_word + 1;
   }
 
-  return (n_entries == 0) ? 0 : 1;
+  /* If we reach this point, we have at least 1 entry. */
+  tor_assert(n_entries > 0)
+  return 1;
 }
 
 /** Release all storage used by the directory server. */