Differences From Artifact [2a2a047c69]:
- File src/OFApplication.m — part of check-in [0abbcb442c] at 2017-02-26 15:38:19 on branch trunk — Rename OF_MAC_OS_X define to OF_MACOS (user: js, size: 11033) [annotate] [blame] [check-ins using]
To Artifact [4ef7cfc06b]:
- File
src/OFApplication.m
— part of check-in
[40cf53506a]
at
2017-04-09 18:22:14
on branch trunk
— Add OFSandbox
Only OpenBSD's pledge() is supported so far. (user: js, size: 11680) [annotate] [blame] [check-ins using]
︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | + + + + | #include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <locale.h> #include <signal.h> #include <unistd.h> #import "OFApplication.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFLocalization.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFThread.h" #import "OFThread+Private.h" #import "OFSandbox.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFSandboxActivationFailedException.h" #if defined(OF_MACOS) # include <crt_externs.h> #elif defined(OF_WINDOWS) # include <windows.h> extern int _CRT_glob; |
︙ | |||
181 182 183 184 185 186 187 188 189 190 191 192 193 194 | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | + + + + + + + | exit(status); #else sceKernelExitGame(); OF_UNREACHABLE #endif } #ifdef OF_HAVE_SANDBOX + (void)activateSandbox: (OFSandbox*)sandbox { [app activateSandbox: sandbox]; } #endif - init { self = [super init]; @try { void *pool; |
︙ | |||
499 500 501 502 503 504 505 506 | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | + + + + + + + + + + + + + + + + + + | - (void)terminateWithStatus: (int)status { [[self class] terminateWithStatus: status]; OF_UNREACHABLE } #ifdef OF_HAVE_SANDBOX - (void)activateSandbox: (OFSandbox*)sandbox { # ifdef OF_HAVE_PLEDGE void *pool = objc_autoreleasePoolPush(); const char *promises = [[sandbox pledgeString] cStringWithEncoding: [OFLocalization encoding]]; if (pledge(promises, NULL) != 0) @throw [OFSandboxActivationFailedException exceptionWithSandbox: sandbox errNo: errno]; objc_autoreleasePoolPop(pool); # endif } #endif @end |