Ensured that ecl_file_len() doesn't return a random value on error.
authorArto Bendiken <arto@bendiken.net>
Tue, 14 Oct 2014 22:02:12 +0000 (22:02 +0000)
committerArto Bendiken <arto@bendiken.net>
Tue, 14 Oct 2014 22:04:30 +0000 (22:04 +0000)
This partially addresses CID 66411 (Unchecked return value from library).
The call to fstat() should still probably have error checking added.

src/c/unixfsys.d

index b64a4b1..f9f6d5c 100644 (file)
@@ -454,6 +454,7 @@ cl_object
 ecl_file_len(int f)
 {
        struct stat filestatus;
+       memset(&filestatus, 0, sizeof(filestatus));
        ecl_disable_interrupts();
        fstat(f, &filestatus);
        ecl_enable_interrupts();