diff --git a/ChangeLog b/ChangeLog index b8055165a..bf71c6eba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-05-13 Richard Frith-Macdonald + + * Source/Tools/gdnc.m: Tidy termination code. + * Source/Additions/GSMime.m: ([GSMimeDocument-copyWithZone:]) + corrected implementation to do a real copy rather than just a + retain. + 2003-05-13 15:57 Alexander Malmberg * Tools/gdnc.m (ihandler): Declare variables. diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index d09c29267..2cb2808a9 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -3617,9 +3617,26 @@ static NSCharacterSet *tokenSet = nil; return s; } +/** + * Returns a copy of the receiver. + */ - (id) copyWithZone: (NSZone*)z { - return RETAIN(self); + GSMimeDocument *c = [GSMimeDocument allocWithZone: z]; + + c->headers = [[NSMutableArray allocWithZone: z] initWithArray: headers + copyItems: YES]; + + if ([content isKindOfClass: [NSArray class]] == YES) + { + c->content = [[NSMutableArray allocWithZone: z] initWithArray: content + copyItems: YES]; + } + else + { + c->content = [content copy]; + } + return c; } - (void) dealloc diff --git a/Tools/gdnc.m b/Tools/gdnc.m index c36622ea0..4f5f71b32 100644 --- a/Tools/gdnc.m +++ b/Tools/gdnc.m @@ -37,16 +37,19 @@ static void ihandler(int sig) { - int i; - char *e; + static BOOL beenHere = NO; + BOOL action; + const char *e; /* - * Reset signals to avoid recursive call of handler. + * Deal with recursive call of handler. */ - for (i = 0; i < NSIG; i++) + if (beenHere == YES) { - signal(i, SIG_DFL); + abort(); } + beenHere = YES; + /* * If asked to terminate, do so cleanly. */ @@ -56,29 +59,30 @@ ihandler(int sig) } #ifdef DEBUG - i = 1; // abort() by default. + action = YES; // abort() by default. #else - i = 0; // kill() or exit() by default. + action = NO; // exit() by default. #endif e = getenv("CRASH_ON_ABORT"); if (e != 0) { if (strcasecmp(e, "yes") == 0 || strcasecmp(e, "true") == 0) - i = 1; + action = YES; else if (strcasecmp(e, "no") == 0 || strcasecmp(e, "false") == 0) - i = 0; + action = NO; else if (isdigit(*e) && *e != '0') - i = 1; + action = YES; else - i = 0; + action = NO; } - if (i == 1) + if (action == YES) { abort(); } else { + fprintf(stderr, "gdnc killed by signal %d\n", sig); exit(sig); } }