From f4e4f8b03353b049ca176642da138d22ea17f43f Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Tue, 5 Apr 2011 16:55:52 +0300 Subject: tests: fs-tests: check return value of functions chdir() returns negative value in case of error. fscanf() returns amount of successfully parsed parameters. Signed-off-by: Andy Shevchenko Signed-off-by: Artem Bityutskiy --- tests/fs-tests/stress/atoms/pdfrun.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/fs-tests/stress') diff --git a/tests/fs-tests/stress/atoms/pdfrun.c b/tests/fs-tests/stress/atoms/pdfrun.c index 3536580..46c70e1 100644 --- a/tests/fs-tests/stress/atoms/pdfrun.c +++ b/tests/fs-tests/stress/atoms/pdfrun.c @@ -40,8 +40,11 @@ void adjust_size(void) total_memory = 0; f = fopen("/proc/meminfo", "r"); - fscanf(f, "%s %lu", dummy, &total_memory); + if (fscanf(f, "%s %lu", dummy, &total_memory) != 2) + perror("fscanf error"); fclose(f); + + if (total_memory > 0 && tests_size_parameter > total_memory / 2) tests_size_parameter = total_memory / 2; } -- cgit v1.2.3