From 9b845c6e367d95c442940578bfc18559d86ec52c Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 21 Jun 2011 23:19:45 +0000 Subject: Coverity: Check for negative lseek return valies in disk_cache::File::GetLength. BUG=none TEST=none CID=11651 Review URL: http://codereview.chromium.org/7218019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89925 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/file_posix.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index 087ff13..6f78b7a 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -260,7 +260,9 @@ bool File::SetLength(size_t length) { size_t File::GetLength() { DCHECK(init_); - size_t ret = lseek(platform_file_, 0, SEEK_END); + off_t ret = lseek(platform_file_, 0, SEEK_END); + if (ret < 0) + return 0; return ret; } -- cgit v1.1