mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fixup for bad characters in name.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22902 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ff7e63c376
commit
0edb8340bd
3 changed files with 26 additions and 2 deletions
|
@ -5,6 +5,9 @@
|
|||
loading of multiple bundles with the same non-nil identifier.
|
||||
Use standardised path as cache key to prevent same bundle being
|
||||
loaded multiple times via symlinks etc.
|
||||
* Source/NSMessagePortNameServer.m: Fixup for names which contain bad
|
||||
characters for in a filename.
|
||||
* Source/win32/NSMessagePortNameServerWin32.m: ditto
|
||||
|
||||
2006-05-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "Foundation/NSFileManager.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSThread.h"
|
||||
#include "GNUstepBase/GSMime.h"
|
||||
|
||||
#include "GSPortPrivate.h"
|
||||
|
||||
|
@ -143,7 +144,16 @@ static void clean_up_names(void)
|
|||
{
|
||||
static NSString *base_path = nil;
|
||||
NSString *path;
|
||||
NSData *data;
|
||||
|
||||
/*
|
||||
* Make sure name is representable as a filename ... assume base64 encoded
|
||||
* strings are valid on all filesystems.
|
||||
*/
|
||||
data = [name dataUsingEncoding: NSUTF8StringEncoding];
|
||||
data = [GSMimeDocument encodeBase64: data];
|
||||
name = [[NSString alloc] initWithData: data encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(name);
|
||||
[serverLock lock];
|
||||
if (!base_path)
|
||||
{
|
||||
|
@ -304,14 +314,15 @@ static void clean_up_names(void)
|
|||
|
||||
if ([[self class] _livePort: path])
|
||||
{
|
||||
NSDebugLLog(@"NSMessagePort", @"fail, is a live port");
|
||||
NSDebugLLog(@"NSMessagePort", @"fail, is a live port (%@)", name);
|
||||
return NO;
|
||||
}
|
||||
|
||||
fd = open([path fileSystemRepresentation], O_CREAT|O_EXCL|O_WRONLY, 0600);
|
||||
if (fd < 0)
|
||||
{
|
||||
NSDebugLLog(@"NSMessagePort", @"fail, can't open file (%m)");
|
||||
NSDebugLLog(@"NSMessagePort", @"fail, can't open file (%@) for %@",
|
||||
path, name);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,16 @@ OutputDebugStringW(L"");
|
|||
|
||||
+ (NSString *) _translate: (NSString *)name
|
||||
{
|
||||
NSData *data;
|
||||
|
||||
/*
|
||||
* Make sure name is representable in the registry ...
|
||||
* assume base64 encoded strings are valid.
|
||||
*/
|
||||
data = [name dataUsingEncoding: NSUTF8StringEncoding];
|
||||
data = [GSMimeDocument encodeBase64: data];
|
||||
name = [[NSString alloc] initWithData: data encoding: NSASCIIStringEncoding];
|
||||
AUTORELEASE(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue