ObjFW  Diff

Differences From Artifact [0eab530ffc]:

To Artifact [c0cd7cc60a]:


152
153
154
155
156
157
158
159

160
161
162
163
164
165
166
152
153
154
155
156
157
158

159
160
161
162
163
164
165
166







-
+







}

@implementation OFApplication
@synthesize programName = _programName, arguments = _arguments;
@synthesize environment = _environment;
#ifdef OF_HAVE_SANDBOX
@synthesize activeSandbox = _activeSandbox;
@synthesize activeExecSandbox = _activeExecSandbox;
@synthesize activeSandboxForChildProcesses = _activeSandboxForChildProcesses;
#endif

+ (OFApplication *)sharedApplication
{
	return app;
}

201
202
203
204
205
206
207
208

209
210

211
212
213
214
215
216
217
201
202
203
204
205
206
207

208
209

210
211
212
213
214
215
216
217







-
+

-
+








#ifdef OF_HAVE_SANDBOX
+ (void)activateSandbox: (OFSandbox *)sandbox
{
	[app activateSandbox: sandbox];
}

+ (void)activateSandboxForExecdProcesses: (OFSandbox *)sandbox
+ (void)activateSandboxForChildProcesses: (OFSandbox *)sandbox
{
	[app activateSandboxForExecdProcesses: sandbox];
	[app activateSandboxForChildProcesses: sandbox];
}
#endif

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}
626
627
628
629
630
631
632
633

634
635
636
637
638

639

640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656


657
658
659
660
626
627
628
629
630
631
632

633
634
635
636
637
638
639

640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655


656
657
658
659
660
661







-
+





+
-
+















-
-
+
+




	objc_autoreleasePoolPop(pool);

	if (_activeSandbox == nil)
		_activeSandbox = [sandbox retain];
# endif
}

- (void)activateSandboxForExecdProcesses: (OFSandbox *)sandbox
- (void)activateSandboxForChildProcesses: (OFSandbox *)sandbox
{
# ifdef OF_HAVE_PLEDGE
	void *pool = objc_autoreleasePoolPush();
	const char *promises;

	if (_activeSandboxForChildProcesses != nil &&
	if (_activeExecSandbox != nil && sandbox != _activeExecSandbox)
	    sandbox != _activeSandboxForChildProcesses)
		@throw [OFInvalidArgumentException exception];

	if (sandbox.unveiledPaths.count != 0)
		@throw [OFInvalidArgumentException exception];

	promises = [sandbox.pledgeString
	    cStringWithEncoding: [OFLocale encoding]];

	if (pledge(NULL, promises) != 0)
		@throw [OFSandboxActivationFailedException
		    exceptionWithSandbox: sandbox
				   errNo: errno];

	objc_autoreleasePoolPop(pool);

	if (_activeExecSandbox == nil)
		_activeExecSandbox = [sandbox retain];
	if (_activeSandboxForChildProcesses == nil)
		_activeSandboxForChildProcesses = [sandbox retain];
# endif
}
#endif
@end