aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-11 00:00:01 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-11 00:00:01 +0000
commit1cbe4adfa9e980a2ab70b36a726947ffffead06b (patch)
treede4616fe5d23f681bc6147bea00fe57ce3f47bc1 /src
parent854e1e4d0d1fcfa9812336ebfae76538a9197351 (diff)
downloadgnunet-1cbe4adfa9e980a2ab70b36a726947ffffead06b.tar.gz
gnunet-1cbe4adfa9e980a2ab70b36a726947ffffead06b.zip
-LRN: Fix kill
Use the same code for killing processes without a control pipe AND the processes for which a control pipe write has failed. Use PLIBC_KILL() instead of kill().
Diffstat (limited to 'src')
-rw-r--r--src/util/os_priority.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 30421a197..434fd979f 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -436,20 +436,13 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
436 proc->control_pipe = npipe_open (proc->childpipename, 436 proc->control_pipe = npipe_open (proc->childpipename,
437 GNUNET_DISK_OPEN_WRITE); 437 GNUNET_DISK_OPEN_WRITE);
438#endif 438#endif
439 if (NULL == proc->control_pipe) 439 if (NULL != proc->control_pipe)
440 { 440 {
441#if WINDOWS 441 ret = GNUNET_DISK_file_write (proc->control_pipe, &csig, sizeof (csig));
442 /* no pipe and windows? can't do this */ 442 if (ret == sizeof (csig))
443 errno = EINVAL; 443 return 0;
444 return -1;
445#else
446 return kill (proc->pid, sig);
447#endif
448 } 444 }
449 ret = GNUNET_DISK_file_write (proc->control_pipe, &csig, sizeof (csig)); 445 /* pipe failed or non-existent, try other methods */
450 if (ret == sizeof (csig))
451 return 0;
452 /* pipe failed, try other methods */
453 switch (sig) 446 switch (sig)
454 { 447 {
455#if !WINDOWS 448#if !WINDOWS
@@ -473,7 +466,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
473 errno = EINVAL; 466 errno = EINVAL;
474 return -1; 467 return -1;
475#else 468#else
476 return kill (proc->pid, sig); 469 return PLIBC_kill (proc->pid, sig);
477#endif 470#endif
478 } 471 }
479} 472}