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

Side by Side Diff: net/dns/dns_config_service_posix.cc

Issue 7839018: Fix usage error for libresolv - res_ninit on OSX requires res_ndestroy to close (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Resolve merge conflict Created 9 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 | tools/valgrind/memcheck/suppressions_mac.txt » ('j') | 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 Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium 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. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/dns_config_service_posix.h" 5 #include "net/dns/dns_config_service_posix.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 17 matching lines...) Expand all
28 success_(false) {} 28 success_(false) {}
29 29
30 void DoRead() OVERRIDE { 30 void DoRead() OVERRIDE {
31 struct __res_state res; 31 struct __res_state res;
32 if ((res_ninit(&res) == 0) && (res.options & RES_INIT)) { 32 if ((res_ninit(&res) == 0) && (res.options & RES_INIT)) {
33 success_ = ConvertResToConfig(res, &dns_config_); 33 success_ = ConvertResToConfig(res, &dns_config_);
34 } else { 34 } else {
35 // Note: res_ninit in glibc always returns 0 and sets RES_INIT. 35 // Note: res_ninit in glibc always returns 0 and sets RES_INIT.
36 success_ = false; 36 success_ = false;
37 } 37 }
38 #if defined(OS_MACOSX)
39 res_ndestroy(&res);
40 #else
38 res_nclose(&res); 41 res_nclose(&res);
42 #endif
39 } 43 }
40 44
41 void OnReadFinished() OVERRIDE { 45 void OnReadFinished() OVERRIDE {
42 if (success_) 46 if (success_)
43 service_->OnConfigRead(dns_config_); 47 service_->OnConfigRead(dns_config_);
44 } 48 }
45 49
46 private: 50 private:
47 virtual ~DnsConfigReader() {} 51 virtual ~DnsConfigReader() {}
48 52
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 dns_config->ndots = res.ndots; 122 dns_config->ndots = res.ndots;
119 dns_config->timeout = base::TimeDelta::FromSeconds(res.retrans); 123 dns_config->timeout = base::TimeDelta::FromSeconds(res.retrans);
120 dns_config->attempts = res.retry; 124 dns_config->attempts = res.retry;
121 dns_config->rotate = res.options & RES_ROTATE; 125 dns_config->rotate = res.options & RES_ROTATE;
122 dns_config->edns0 = res.options & RES_USE_EDNS0; 126 dns_config->edns0 = res.options & RES_USE_EDNS0;
123 127
124 return true; 128 return true;
125 } 129 }
126 130
127 } // namespace net 131 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions_mac.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698