diff --git a/apphilogcat/hiview_applogcat.c b/apphilogcat/hiview_applogcat.c index 69d0348a29e96804f10355c34f9e4f4e19f2932b..58b844dd84d280a6cc7a1d85798a90775997967e 100755 --- a/apphilogcat/hiview_applogcat.c +++ b/apphilogcat/hiview_applogcat.c @@ -43,10 +43,13 @@ static int FileSize(const char *filename) if (!fp) { return -1; } - fseek(fp, 0L, SEEK_END); - int size = ftell(fp); - fclose(fp); + int size = 0; + int ret = fseek(fp, 0L, SEEK_END); + if (ret == 0) { + size = ftell(fp); + } + fclose(fp); return size; }