From: jiyong.min Date: Tue, 29 Jan 2019 00:37:27 +0000 (+0900) Subject: Add to check the return of fseek() X-Git-Tag: accepted/tizen/unified/20190207.120249^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f4945a2f4fd76b976cb7aa22d7eecf4c7acccf6;p=platform%2Fcore%2Fmultimedia%2Flibmm-fileinfo.git Add to check the return of fseek() - If fseek() is failed, -1 is returned and errno is set to indicate the errors. Change-Id: I7174ca625da1026ebe07cb72fd97459d89c05d75 --- diff --git a/tests/mm_file_test.c b/tests/mm_file_test.c index 3116ddc..65c9c6b 100755 --- a/tests/mm_file_test.c +++ b/tests/mm_file_test.c @@ -175,9 +175,9 @@ inline static int mm_file_is_little_endian(void) do { \ FILE *fp = fopen(FILE_PATH, "r"); \ if (fp) { \ - fseek(fp, 0, SEEK_END); \ + if (fseek(fp, 0, SEEK_END) < 0) { printf("fseek failed\n"); fclose(fp); break; } \ size = ftell(fp); \ - fseek(fp, 0, SEEK_SET); \ + if (fseek(fp, 0, SEEK_SET) < 0) { printf("fseek failed\n"); fclose(fp); break; } \ if (size > 0) data = malloc(size); \ if (data != NULL) { if (fread(data, size, sizeof(char), fp) != size) { printf("fread error\n"); } } \ fclose(fp); \