mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
fread()/fwrite() return the unsigned count of elements read/written or a short count or zero in case of an error. Check if the number of elements read/written matches the expectation. In case of fread(), if it does not match, check if an error occurred and otherwise assume the file to be too small. In case of fwrite(), if it does not match, assume an error. Resolves Cppcheck style warnings: [zkey/pkey.c:161]: (style) Checking if unsigned variable 'count' is less than zero. [zkey/pkey.c:209]: (style) Checking if unsigned variable 'count' is less than zero. [zkey/pkey.c:299]: (style) Checking if unsigned variable 'count' is less than zero. Cc: Ingo Franzki <ifranzki@de.ibm.com> Signed-off-by: Jens Remus <jremus@linux.ibm.com> Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>