Mercurial > trustbridge
comparison common/listutil.c @ 89:00f9b91f4039
Do not leak a byte if the file is empty
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 20 Mar 2014 18:40:15 +0000 |
parents | 6f1a73575c99 |
children | 4980b0deb773 |
comparison
equal
deleted
inserted
replaced
88:abc76b750ea8 | 89:00f9b91f4039 |
---|---|
55 if (f == NULL) | 55 if (f == NULL) |
56 return READ_FILE_UNREADABLE; | 56 return READ_FILE_UNREADABLE; |
57 | 57 |
58 fseek(f, 0, SEEK_END); | 58 fseek(f, 0, SEEK_END); |
59 file_size = ftell(f); | 59 file_size = ftell(f); |
60 if (file_size < 0){ | 60 if (file_size <= 0){ |
61 fclose(f); | 61 fclose(f); |
62 return READ_FILE_UNREADABLE; | 62 return READ_FILE_UNREADABLE; |
63 } | 63 } |
64 | 64 |
65 fseek(f, 0, SEEK_SET); | 65 fseek(f, 0, SEEK_SET); |