aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-10 21:50:28 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-10 21:50:28 +0000
commit09f33b79ebc1c117aba76602bdd9e1c3fa0cda1a (patch)
tree1288297409beb022220651ee25f15576b0a2c67b /src
parent4281ebb1604cded91b6e6ab57a25cd4751ee81cd (diff)
downloadgnunet-09f33b79ebc1c117aba76602bdd9e1c3fa0cda1a.tar.gz
gnunet-09f33b79ebc1c117aba76602bdd9e1c3fa0cda1a.zip
-avoid problems with partial reads by using 1 byte for signals
Diffstat (limited to 'src')
-rw-r--r--src/util/os_priority.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 641afa6d3..4f3c5e622 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -325,8 +325,8 @@ parent_control_handler (void *cls,
325 const struct GNUNET_SCHEDULER_TaskContext *tc) 325 const struct GNUNET_SCHEDULER_TaskContext *tc)
326{ 326{
327 struct GNUNET_DISK_FileHandle *control_pipe = cls; 327 struct GNUNET_DISK_FileHandle *control_pipe = cls;
328 int sig; 328 char sig;
329 329
330 LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, 330 LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__,
331 tc->reason); 331 tc->reason);
332 if (tc->reason & 332 if (tc->reason &
@@ -347,7 +347,7 @@ parent_control_handler (void *cls,
347 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 347 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
348 control_pipe, &parent_control_handler, 348 control_pipe, &parent_control_handler,
349 control_pipe); 349 control_pipe);
350 raise (sig); 350 raise ((int) sig);
351} 351}
352 352
353 353
@@ -425,7 +425,9 @@ int
425GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) 425GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
426{ 426{
427 int ret; 427 int ret;
428 char csig;
428 429
430 csig = (char) sig;
429#if !WINDOWS 431#if !WINDOWS
430 if ( (NULL == proc->control_pipe) && 432 if ( (NULL == proc->control_pipe) &&
431 (NULL != proc->childpipename) ) 433 (NULL != proc->childpipename) )
@@ -442,8 +444,8 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
442 return kill (proc->pid, sig); 444 return kill (proc->pid, sig);
443#endif 445#endif
444 } 446 }
445 ret = GNUNET_DISK_file_write (proc->control_pipe, &sig, sizeof (sig)); 447 ret = GNUNET_DISK_file_write (proc->control_pipe, &csig, sizeof (csig));
446 if (ret == sizeof (sig)) 448 if (ret == sizeof (csig))
447 return 0; 449 return 0;
448 /* pipe failed, try other methods */ 450 /* pipe failed, try other methods */
449 switch (sig) 451 switch (sig)