trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject trafficserver git commit: TS-3287: Test for equality with zero on fd as well
Date Thu, 05 Feb 2015 15:32:59 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 63d25f9ad -> 01121ce82


TS-3287: Test for equality with zero on fd as well

Coverity CID #1021842


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/01121ce8
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/01121ce8
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/01121ce8

Branch: refs/heads/master
Commit: 01121ce827e246496f74e0ce4ed8770b67cb524d
Parents: 63d25f9
Author: Phil Sorber <sorber@apache.org>
Authored: Thu Feb 5 08:32:19 2015 -0700
Committer: Phil Sorber <sorber@apache.org>
Committed: Thu Feb 5 08:32:19 2015 -0700

----------------------------------------------------------------------
 iocore/cache/Cache.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/01121ce8/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index cb2dde6..af61fa5 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -728,7 +728,7 @@ CacheProcessor::start_internal(int flags)
     if (fd < 0 && (opts & O_CREAT))  // Try without O_DIRECT if this is a
file on filesystem, e.g. tmpfs.
       fd = open(path, DEFAULT_CACHE_OPTIONS | O_CREAT, 0644);
 
-    if (fd > 0) {
+    if (fd >= 0) {
       if (!sd->file_pathname) {
         if (ftruncate(fd, ((uint64_t) blocks) * STORE_BLOCK_SIZE) < 0) {
           Warning("unable to truncate cache file '%s' to %d blocks", path, blocks);
@@ -773,7 +773,7 @@ CacheProcessor::start_internal(int flags)
       else
         Warning("cache unable to open '%s': %s", path, strerror(errno));
     }
-    if (fd > 0) {
+    if (fd >= 0) {
       close(fd);
     }
   }


Mime
View raw message