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

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

Issue 2334503002: Revert of Split parts of //chrome/utility's BUILD.gn into //chrome/utility/safe_browsing/mac. (Closed)
Patch Set: 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
36 namespace { 28 namespace {
37 29
38 // SafeDMG (crdmg) is a utility that can perform a list or extract operation 30 // SafeDMG (crdmg) is a utility that can perform a list or extract operation
39 // for DMG files. It does so without using the OS X built-in support for DMG 31 // for DMG files. It does so without using the OS X built-in support for DMG
40 // files, and it operates under a restrictive sandbox. This is suitable for 32 // files, and it operates under a restrictive sandbox. This is suitable for
41 // examining DMG files of untrusted origins. 33 // examining DMG files of untrusted origins.
42 // 34 //
43 // Usage: crdmg file.dmg [unpack-path] 35 // Usage: crdmg file.dmg [unpack-path]
44 // If unpack-path is provided, it will extract the contents of file.dmg to the 36 // If unpack-path is provided, it will extract the contents of file.dmg to the
45 // directory, creating it if it does not exit. Otherwise, it will merely list 37 // 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
256 248
257 return true; 249 return true;
258 } 250 }
259 251
260 } // namespace 252 } // namespace
261 253
262 int main(int argc, const char* argv[]) { 254 int main(int argc, const char* argv[]) {
263 SafeDMG safe_dmg; 255 SafeDMG safe_dmg;
264 return safe_dmg.Main(argc, argv); 256 return safe_dmg.Main(argc, argv);
265 } 257 }
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