mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Apply security fix and minor portability tweaks.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18936 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4b1c074975
commit
667fc062d6
4 changed files with 83 additions and 16 deletions
|
@ -39,6 +39,9 @@
|
|||
#include "Foundation/NSConnection.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "Foundation/NSPathUtilities.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSFileManager.h"
|
||||
#include "Foundation/NSProcessInfo.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -1186,19 +1189,27 @@ static unsigned wordAlign;
|
|||
+ (id) new
|
||||
{
|
||||
static int unique_index = 0;
|
||||
NSString *path;
|
||||
NSString *path;
|
||||
NSNumber *p = [NSNumber numberWithInt: 0700];
|
||||
NSDictionary *attr;
|
||||
|
||||
attr = [NSDictionary dictionaryWithObject: p
|
||||
forKey: NSFilePosixPermissions];
|
||||
|
||||
path = NSTemporaryDirectory();
|
||||
|
||||
path = [path stringByAppendingPathComponent: @"NSMessagePort"];
|
||||
mkdir([path fileSystemRepresentation], 0700);
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath: path
|
||||
attributes: attr];
|
||||
|
||||
path = [path stringByAppendingPathComponent: @"ports"];
|
||||
mkdir([path fileSystemRepresentation], 0700);
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath: path
|
||||
attributes: attr];
|
||||
|
||||
M_LOCK(messagePortLock);
|
||||
path = [path stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat: @"%i.%i", getpid(), unique_index++]];
|
||||
[NSString stringWithFormat: @"%i.%i",
|
||||
[[NSProcessInfo processInfo] processIdentifier], unique_index++]];
|
||||
M_UNLOCK(messagePortLock);
|
||||
|
||||
return RETAIN([self _portWithName: [path fileSystemRepresentation]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue