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

Side by Side Diff: base/mac/authorization_util.mm

Issue 1773303002: Prepare base/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | base/mac/sdk_forward_declarations.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/mac/authorization_util.h" 5 #include "base/mac/authorization_util.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/wait.h> 9 #include <sys/wait.h>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // pipe may be NULL, but this function needs one. In that case, use a local 101 // pipe may be NULL, but this function needs one. In that case, use a local
102 // pipe. 102 // pipe.
103 FILE* local_pipe; 103 FILE* local_pipe;
104 FILE** pipe_pointer; 104 FILE** pipe_pointer;
105 if (pipe) { 105 if (pipe) {
106 pipe_pointer = pipe; 106 pipe_pointer = pipe;
107 } else { 107 } else {
108 pipe_pointer = &local_pipe; 108 pipe_pointer = &local_pipe;
109 } 109 }
110 110
111 // Deprecated in OS X 10.7. https://crbug.com/592663.
112 #pragma clang diagnostic push
113 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
111 // AuthorizationExecuteWithPrivileges wants |char* const*| for |arguments|, 114 // AuthorizationExecuteWithPrivileges wants |char* const*| for |arguments|,
112 // but it doesn't actually modify the arguments, and that type is kind of 115 // but it doesn't actually modify the arguments, and that type is kind of
113 // silly and callers probably aren't dealing with that. Put the cast here 116 // silly and callers probably aren't dealing with that. Put the cast here
114 // to make things a little easier on callers. 117 // to make things a little easier on callers.
115 OSStatus status = AuthorizationExecuteWithPrivileges(authorization, 118 OSStatus status = AuthorizationExecuteWithPrivileges(authorization,
116 tool_path, 119 tool_path,
117 options, 120 options,
118 (char* const*)arguments, 121 (char* const*)arguments,
119 pipe_pointer); 122 pipe_pointer);
123 #pragma clang diagnostic pop
120 if (status != errAuthorizationSuccess) { 124 if (status != errAuthorizationSuccess) {
121 return status; 125 return status;
122 } 126 }
123 127
124 int line_pid = -1; 128 int line_pid = -1;
125 size_t line_length = 0; 129 size_t line_length = 0;
126 char* line_c = fgetln(*pipe_pointer, &line_length); 130 char* line_c = fgetln(*pipe_pointer, &line_length);
127 if (line_c) { 131 if (line_c) {
128 if (line_length > 0 && line_c[line_length - 1] == '\n') { 132 if (line_length > 0 && line_c[line_length - 1] == '\n') {
129 // line_c + line_length is the start of the next line if there is one. 133 // line_c + line_length is the start of the next line if there is one.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 191 }
188 } else { 192 } else {
189 *exit_status_pointer = -1; 193 *exit_status_pointer = -1;
190 } 194 }
191 195
192 return status; 196 return status;
193 } 197 }
194 198
195 } // namespace mac 199 } // namespace mac
196 } // namespace base 200 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/mac/sdk_forward_declarations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698