Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/leveldatabase/env_chromium.cc

Issue 23681009: Record errno for SyncParent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. See the AUTHORS file for names of contributors. 3 // found in the LICENSE file. See the AUTHORS file for names of contributors.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 } 446 }
447 447
448 Status ChromiumWritableFile::SyncParent() { 448 Status ChromiumWritableFile::SyncParent() {
449 Status s; 449 Status s;
450 #if !defined(OS_WIN) 450 #if !defined(OS_WIN)
451 TRACE_EVENT0("leveldb", "SyncParent"); 451 TRACE_EVENT0("leveldb", "SyncParent");
452 452
453 int parent_fd = 453 int parent_fd =
454 HANDLE_EINTR(open(parent_dir_.c_str(), O_RDONLY)); 454 HANDLE_EINTR(open(parent_dir_.c_str(), O_RDONLY));
455 if (parent_fd < 0) 455 if (parent_fd < 0) {
456 return MakeIOError(parent_dir_, strerror(errno), kSyncParent); 456 int saved_errno = errno;
457 return MakeIOError(
458 parent_dir_, strerror(saved_errno), kSyncParent, saved_errno);
459 }
457 if (HANDLE_EINTR(fsync(parent_fd)) != 0) { 460 if (HANDLE_EINTR(fsync(parent_fd)) != 0) {
458 s = MakeIOError(parent_dir_, strerror(errno), kSyncParent); 461 int saved_errno = errno;
462 s = MakeIOError(
463 parent_dir_, strerror(saved_errno), kSyncParent, saved_errno);
459 }; 464 };
460 HANDLE_EINTR(close(parent_fd)); 465 HANDLE_EINTR(close(parent_fd));
461 #endif 466 #endif
462 return s; 467 return s;
463 } 468 }
464 469
465 Status ChromiumWritableFile::Append(const Slice& data) { 470 Status ChromiumWritableFile::Append(const Slice& data) {
466 if (is_manifest_ && tracker_->DoesDirNeedSync(filename_)) { 471 if (is_manifest_ && tracker_->DoesDirNeedSync(filename_)) {
467 Status s = SyncParent(); 472 Status s = SyncParent();
468 if (!s.ok()) 473 if (!s.ok())
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 Env* IDBEnv() { 962 Env* IDBEnv() {
958 return leveldb_env::idb_env.Pointer(); 963 return leveldb_env::idb_env.Pointer();
959 } 964 }
960 965
961 Env* Env::Default() { 966 Env* Env::Default() {
962 return leveldb_env::default_env.Pointer(); 967 return leveldb_env::default_env.Pointer();
963 } 968 }
964 969
965 } // namespace leveldb 970 } // namespace leveldb
966 971
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698