aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-04-03 08:57:49 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-04-13 18:26:46 +0200
commit27c1bc8dfb82f1ccab6bd9b4ce4f54e1fbf7bc3d (patch)
tree58415b672beea8b9e9fa6ccb919a076a4a4edf8e
parentf0c0c56e9b67413ef397876e563c14b02a5deb0f (diff)
downloadbusybox-w32-27c1bc8dfb82f1ccab6bd9b4ce4f54e1fbf7bc3d.tar.gz
busybox-w32-27c1bc8dfb82f1ccab6bd9b4ce4f54e1fbf7bc3d.tar.bz2
busybox-w32-27c1bc8dfb82f1ccab6bd9b4ce4f54e1fbf7bc3d.zip
build system: avoid build failure during bisection
Commit 4bdc914ff (build system: fix compiler warnings) added a test on the return value of fgets() in split-include.c. During bisection it's possible to go back to a state where a configuration value didn't exist. This results in an empty include file corresponding to the missing feature. If a subsequent bisection returns to a state where the feature exists split-include treats the empty file as an error and the build fails. Add a call to ferror() to distinguish between fgets() failing due to an error and due to there being no data to read. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--scripts/basic/split-include.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/basic/split-include.c b/scripts/basic/split-include.c
index 791d142a8..a38ac3427 100644
--- a/scripts/basic/split-include.c
+++ b/scripts/basic/split-include.c
@@ -131,7 +131,7 @@ int main(int argc, const char * argv [])
131 is_same = 0; 131 is_same = 0;
132 if ((fp_target = fopen(ptarget, "r")) != NULL) 132 if ((fp_target = fopen(ptarget, "r")) != NULL)
133 { 133 {
134 if (!fgets(old_line, buffer_size, fp_target)) 134 if (!fgets(old_line, buffer_size, fp_target) && ferror(fp_target))
135 ERROR_EXIT(ptarget); 135 ERROR_EXIT(ptarget);
136 if (fclose(fp_target) != 0) 136 if (fclose(fp_target) != 0)
137 ERROR_EXIT(ptarget); 137 ERROR_EXIT(ptarget);