diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-11-01 20:47:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-11-01 20:47:52 +0000 |
commit | 652e89b59ed2207c2c12172fdabcd6e659995c81 (patch) | |
tree | f054c819d483c1056e18c1099afd4c7fcd2582a0 /src/util/crypto_ksk.c | |
parent | 5e4113e83368849500792e57946c3d8dd9e548d8 (diff) | |
download | gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.tar.gz gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.zip |
fixing bio testcase and a bug in bio.c, also indenting
Diffstat (limited to 'src/util/crypto_ksk.c')
-rw-r--r-- | src/util/crypto_ksk.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c index 170974b2f..96f8140ad 100644 --- a/src/util/crypto_ksk.c +++ b/src/util/crypto_ksk.c | |||
@@ -774,11 +774,8 @@ static pid_t genproc; | |||
774 | * blocked gathering entropy. | 774 | * blocked gathering entropy. |
775 | */ | 775 | */ |
776 | static void | 776 | static void |
777 | entropy_generator (void *cls, | 777 | entropy_generator (void *cls, |
778 | const char *what, | 778 | const char *what, int printchar, int current, int total) |
779 | int printchar, | ||
780 | int current, | ||
781 | int total) | ||
782 | { | 779 | { |
783 | unsigned long code; | 780 | unsigned long code; |
784 | enum GNUNET_OS_ProcessStatusType type; | 781 | enum GNUNET_OS_ProcessStatusType type; |
@@ -789,50 +786,45 @@ entropy_generator (void *cls, | |||
789 | if (current == total) | 786 | if (current == total) |
790 | { | 787 | { |
791 | if (genproc != 0) | 788 | if (genproc != 0) |
792 | { | 789 | { |
793 | if (0 != PLIBC_KILL(genproc, SIGTERM)) | 790 | if (0 != PLIBC_KILL (genproc, SIGTERM)) |
794 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, | 791 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill"); |
795 | "kill"); | 792 | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); |
796 | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); | 793 | genproc = 0; |
797 | genproc = 0; | 794 | } |
798 | } | ||
799 | return; | 795 | return; |
800 | } | 796 | } |
801 | if (genproc != 0) | 797 | if (genproc != 0) |
802 | { | 798 | { |
803 | ret = GNUNET_OS_process_status (genproc, | 799 | ret = GNUNET_OS_process_status (genproc, &type, &code); |
804 | &type, | ||
805 | &code); | ||
806 | if (ret == GNUNET_NO) | 800 | if (ret == GNUNET_NO) |
807 | return; /* still running */ | 801 | return; /* still running */ |
808 | if (ret == GNUNET_SYSERR) | 802 | if (ret == GNUNET_SYSERR) |
809 | { | 803 | { |
810 | GNUNET_break (0); | 804 | GNUNET_break (0); |
811 | return; | 805 | return; |
812 | } | 806 | } |
813 | if (0 != PLIBC_KILL(genproc, SIGTERM)) | 807 | if (0 != PLIBC_KILL (genproc, SIGTERM)) |
814 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, | 808 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill"); |
815 | "kill"); | ||
816 | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); | 809 | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); |
817 | genproc = 0; | 810 | genproc = 0; |
818 | } | 811 | } |
819 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 812 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
820 | _("Starting `%s' process to generate entropy\n"), | 813 | _("Starting `%s' process to generate entropy\n"), "find"); |
821 | "find"); | ||
822 | genproc = GNUNET_OS_start_process ("sh", | 814 | genproc = GNUNET_OS_start_process ("sh", |
823 | "sh", | 815 | "sh", |
824 | "-c", | 816 | "-c", |
825 | "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", | 817 | "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", |
826 | NULL); | 818 | NULL); |
827 | } | 819 | } |
828 | 820 | ||
829 | 821 | ||
830 | static void | 822 | static void |
831 | killfind () | 823 | killfind () |
832 | { | 824 | { |
833 | if (genproc != 0) | 825 | if (genproc != 0) |
834 | { | 826 | { |
835 | PLIBC_KILL(genproc, SIGKILL); | 827 | PLIBC_KILL (genproc, SIGKILL); |
836 | genproc = 0; | 828 | genproc = 0; |
837 | } | 829 | } |
838 | } | 830 | } |