Repository: trafficserver
Updated Branches:
  refs/heads/master 4ed316a0c -> f2a7e2895


TS-3377: Fix bad file descriptor handling

This was caused by commit 01121ce827e246496f74e0ce4ed8770b67cb524d
that was to fix Coverity CID #1021842 and reverted by
4ed316a0cbd136e5f66205e2d363126ac86f90da. I am re-adding that patch
as well.


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

Branch: refs/heads/master
Commit: f2a7e289548bea3b17fb962cfdeced9f30cd10ef
Parents: 4ed316a
Author: Phil Sorber <[email protected]>
Authored: Fri Feb 6 20:24:13 2015 -0700
Committer: Phil Sorber <[email protected]>
Committed: Fri Feb 6 20:30:58 2015 -0700

----------------------------------------------------------------------
 CHANGES               | 3 +++
 iocore/cache/Cache.cc | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f2a7e289/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 33f0ecf..74f1906 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3377] Fix bad file descriptor handling that caused disks in
+   storage.config to be marked bad.
+
   *) [TS-3305] fix minor bugs in ats lua plugin.
 
   *) [TS-3369] fix bug in header setting functions in lua plugin.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f2a7e289/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index cb2dde6..8ac7946 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);
@@ -764,7 +764,7 @@ CacheProcessor::start_internal(int flags)
 #else
         gdisks[gndisks]->open(path, blocks, skip, sector_size, fd, clear);
 #endif
-        fd = 0;
+        fd = -1;
         gndisks++;
       }
     } else {
@@ -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);
     }
   }

Reply via email to