ObjFW  Diff

Differences From Artifact [b2fba3a19f]:

To Artifact [3a8fa1bdc6]:


1
2
3
4

5
6
7
8
9
10
11
1



2
3
4
5
6
7
8
9

-
-
-
+







/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018, 2019, 2020
 *   Jonathan Schleifer <js@nil.im>
 * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
127
128
129
130
131
132
133
134

135
136
137

138
139
140
141
142
143
144
145
125
126
127
128
129
130
131

132

133

134

135
136
137
138
139
140
141







-
+
-

-
+
-







	OFSandbox *sandbox = [OFSandbox sandbox];
	@try {
		sandbox.allowsStdIO = true;
		sandbox.allowsReadingFiles = true;
		sandbox.allowsUserDatabaseReading = true;

		for (OFString *path in optionsParser.remainingArguments)
			[sandbox unveilPath: path
			[sandbox unveilPath: path permissions: @"r"];
				permissions: @"r"];

		[sandbox unveilPath: @LANGUAGE_DIR
		[sandbox unveilPath: @LANGUAGE_DIR permissions: @"r"];
			permissions: @"r"];

		[OFApplication of_activateSandbox: sandbox];
	} @finally {
		[sandbox release];
	}
#endif

176
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191
172
173
174
175
176
177
178

179

180
181
182
183
184
185
186







-
+
-







		void *pool = objc_autoreleasePoolPush();
		OFStream *file;

		if ([path isEqual: @"-"])
			file = of_stdin;
		else {
			@try {
				file = [OFFile fileWithPath: path
				file = [OFFile fileWithPath: path mode: @"r"];
						       mode: @"r"];
			} @catch (OFOpenItemFailedException *e) {
				OFString *error = [OFString
				    stringWithCString: strerror(e.errNo)
					     encoding: [OFLocale encoding]];

				[of_stderr writeLine: OF_LOCALIZED(
				    @"failed_to_open_file",