PlowRandom.c: warning: variable 'f2' is used uninitialized

PlowRandom.c:301:9: warning: variable 'f2' is used uninitialized whenever 'if' condition is true

clang18 -Wall warning cleanup [-Wsometimes-uninitialized]
This commit is contained in:
Darryl L. Miles 2024-10-04 19:44:40 +01:00 committed by Tim Edwards
parent 4206ed2436
commit 3919cc5b63
1 changed files with 5 additions and 3 deletions

View File

@ -294,7 +294,7 @@ plowFileDiff(file1, file2)
char *file2;
{
char b1[BUFSIZ], b2[BUFSIZ];
int f1, f2;
int f1 = -1, f2 = -1;
int n1, n2;
bool ret = FALSE;
@ -310,7 +310,9 @@ plowFileDiff(file1, file2)
ret = TRUE;
done:
(void) close(f1);
(void) close(f2);
if (f1 >= 0)
(void) close(f1);
if (f2 >= 0)
(void) close(f2);
return (ret);
}