summaryrefslogtreecommitdiff
path: root/win32/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/signal.c')
-rw-r--r--win32/signal.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/win32/signal.c b/win32/signal.c
index facede8c40f0..c72107975f0c 100644
--- a/win32/signal.c
+++ b/win32/signal.c
@@ -1,4 +1,4 @@
-/*$Header: /p/tcsh/cvsroot/tcsh/win32/signal.c,v 1.12 2010/05/13 22:04:17 amold Exp $*/
+/*$Header: /p/tcsh/cvsroot/tcsh/win32/signal.c,v 1.13 2014/08/13 23:39:34 amold Exp $*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
@@ -432,6 +432,9 @@ unsigned int alarm(unsigned int seconds) {
if (!__halarm) {
__halarm=CreateEvent(&secd,FALSE,FALSE,NULL);
+ if(!__halarm) {
+ return 0;
+ }
}
if(__alarm_set )
SetEvent(__halarm);
@@ -512,22 +515,27 @@ void sigchild_thread(struct thread_args *args) {
}
void start_sigchild_thread(HANDLE hproc, DWORD pid) {
- struct thread_args *args=heap_alloc(sizeof(struct thread_args));
- DWORD tid;
- HANDLE hthr;
- args->hproc = hproc;
- args->pid = pid;
+ struct thread_args *args=heap_alloc(sizeof(struct thread_args));
+ DWORD tid;
+ HANDLE hthr;
+ if(!args) {
+ return;
+ }
+ args->hproc = hproc;
+ args->pid = pid;
dprintf("creating sigchild thread for pid %d\n",pid);
- hthr = CreateThread(NULL,
- gdwStackSize,
- (LPTHREAD_START_ROUTINE)sigchild_thread,
- (LPVOID)args,
- 0,
- &tid);
+ hthr = CreateThread(NULL,
+ gdwStackSize,
+ (LPTHREAD_START_ROUTINE)sigchild_thread,
+ (LPVOID)args,
+ 0,
+ &tid);
- CloseHandle(hthr);
+ if(hthr) {
+ CloseHandle(hthr);
+ }
}
int kill(int pid, int sig) {
@@ -568,6 +576,7 @@ int kill(int pid, int sig) {
errno = ESRCH;
ret = -1;
dprintf("proc %d not found\n",pid);
+ break;
}
else{
dprintf("proc %d found\n",pid);