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

Side by Side Diff: chrome/utility/safe_browsing/mac/crdmg.cc

Issue 2325783002: Split parts of //chrome/utility's BUILD.gn into //chrome/utility/safe_browsing/mac. (Closed)
Patch Set: Fix gn --check Created 4 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
« no previous file with comments | « chrome/utility/safe_browsing/mac/BUILD.gn ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <limits.h> 7 #include <limits.h>
8 #include <sandbox.h> 8 #include <sandbox.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 #include <stdio.h> 11 #include <stdio.h>
12 #include <stdlib.h> 12 #include <stdlib.h>
13 #include <string.h> 13 #include <string.h>
14 #include <sys/stat.h> 14 #include <sys/stat.h>
15 15
16 #include <string> 16 #include <string>
17 17
18 #include "base/files/file.h" 18 #include "base/files/file.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/posix/eintr_wrapper.h" 21 #include "base/posix/eintr_wrapper.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
24 #include "chrome/utility/safe_browsing/mac/hfs.h" 24 #include "chrome/utility/safe_browsing/mac/hfs.h"
25 #include "chrome/utility/safe_browsing/mac/read_stream.h" 25 #include "chrome/utility/safe_browsing/mac/read_stream.h"
26 #include "chrome/utility/safe_browsing/mac/udif.h" 26 #include "chrome/utility/safe_browsing/mac/udif.h"
27 27
28 // This executable only works on 10.10+, so unconditionally use these functions
29 // to make sandboxing easier.
30 extern "C" {
31 int mkdirat(int, const char *, mode_t);
32 int openat(int, const char *, int, ...);
33 int unlinkat(int, const char *, int);
34 }
35
28 namespace { 36 namespace {
29 37
30 // SafeDMG (crdmg) is a utility that can perform a list or extract operation 38 // SafeDMG (crdmg) is a utility that can perform a list or extract operation
31 // for DMG files. It does so without using the OS X built-in support for DMG 39 // for DMG files. It does so without using the OS X built-in support for DMG
32 // files, and it operates under a restrictive sandbox. This is suitable for 40 // files, and it operates under a restrictive sandbox. This is suitable for
33 // examining DMG files of untrusted origins. 41 // examining DMG files of untrusted origins.
34 // 42 //
35 // Usage: crdmg file.dmg [unpack-path] 43 // Usage: crdmg file.dmg [unpack-path]
36 // If unpack-path is provided, it will extract the contents of file.dmg to the 44 // If unpack-path is provided, it will extract the contents of file.dmg to the
37 // directory, creating it if it does not exit. Otherwise, it will merely list 45 // directory, creating it if it does not exit. Otherwise, it will merely list
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 256
249 return true; 257 return true;
250 } 258 }
251 259
252 } // namespace 260 } // namespace
253 261
254 int main(int argc, const char* argv[]) { 262 int main(int argc, const char* argv[]) {
255 SafeDMG safe_dmg; 263 SafeDMG safe_dmg;
256 return safe_dmg.Main(argc, argv); 264 return safe_dmg.Main(argc, argv);
257 } 265 }
OLDNEW
« no previous file with comments | « chrome/utility/safe_browsing/mac/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698