aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo von lynX <lynX@time.to.get.psyced.org>2016-06-09 14:36:14 +0000
committerCarlo von lynX <lynX@time.to.get.psyced.org>2016-06-09 14:36:14 +0000
commita970e9d70979c0e378a009791dc9da6c029f8526 (patch)
tree4cce2ce03d93461707a8cdbbe74e09e0048e650c
parent727c093dc23c71c792261e295c3d628824bd8ccc (diff)
downloadgnunet-a970e9d70979c0e378a009791dc9da6c029f8526.tar.gz
gnunet-a970e9d70979c0e378a009791dc9da6c029f8526.zip
improved usability for gnunet-logread -f
-rwxr-xr-xcontrib/gnunet-logread22
-rw-r--r--src/social/social_api.c4
2 files changed, 19 insertions, 7 deletions
diff --git a/contrib/gnunet-logread b/contrib/gnunet-logread
index 6205f4123..2e54d133f 100755
--- a/contrib/gnunet-logread
+++ b/contrib/gnunet-logread
@@ -31,9 +31,13 @@ Options:
31 -m <regex> Only pass messages matching a regular expression. 31 -m <regex> Only pass messages matching a regular expression.
32X 32X
33 33
34use POSIX qw(mkfifo);
35
34use Term::ANSIColor qw(:constants :pushpop); 36use Term::ANSIColor qw(:constants :pushpop);
35$Term::ANSIColor::AUTOLOCAL = 1; 37$Term::ANSIColor::AUTOLOCAL = 1;
36 38
39my %levels = ( NONE => 0, ERROR => 1, WARNING => 2, INFO => 4, DEBUG => 8 );
40
37# Message type numbers to names 41# Message type numbers to names
38my %msgtypes; 42my %msgtypes;
39my $prefix = $ENV{GNUNET_PREFIX} || '/usr'; 43my $prefix = $ENV{GNUNET_PREFIX} || '/usr';
@@ -57,10 +61,19 @@ Try also '$0 -h' for help
57X 61X
58} 62}
59 63
60my %levels = ( NONE => 0, ERROR => 1, WARNING => 2, INFO => 4, DEBUG => 8 ); 64die "You can't read and write the socket at the same time"
61if (exists $opts{n}) 65 if exists $opts{f} and exists $opts{n};
62{ 66
63 die "You can't read and write the socket at the same time" if exists $opts{f}; 67if ((exists $opts{n} or exists $opts{f}) and not -r $ipc) {
68 undef $!;
69 die "Could not mkfifo $ipc: $!" unless mkfifo $ipc, 0600;
70 system('chgrp', 'gnunet', $ipc);
71 die "Could not chgrp $ipc to 'gnunet': $!" if $!;
72 chmod 0660, $ipc;
73 die "Could not chmod $ipc to allow gnunet group writes: $!" if $!;
74}
75
76if (exists $opts{n}) {
64 $name = $opts{n}; 77 $name = $opts{n};
65 $msg_level = $opts{L} && exists $levels{$opts{L}} ? $levels{$opts{L}} : 0; 78 $msg_level = $opts{L} && exists $levels{$opts{L}} ? $levels{$opts{L}} : 0;
66 $msg_regex = $opts{m}; 79 $msg_regex = $opts{m};
@@ -69,7 +82,6 @@ if (exists $opts{n})
69} 82}
70 83
71if (exists $opts{f}) { 84if (exists $opts{f}) {
72 system('/bin/mkfifo', $ipc) unless -r $ipc;
73 open(I, $ipc) or die "Cannot read from $ipc: $!"; 85 open(I, $ipc) or die "Cannot read from $ipc: $!";
74 &perform while <I>; 86 &perform while <I>;
75 close I; 87 close I;
diff --git a/src/social/social_api.c b/src/social/social_api.c
index 3a57af5dd..5f144b88a 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -959,8 +959,8 @@ app_recv_place (void *cls,
959 ego = GNUNET_CONTAINER_multihashmap_get (app->egos, &ego_pub_hash); 959 ego = GNUNET_CONTAINER_multihashmap_get (app->egos, &ego_pub_hash);
960 if (NULL == ego) 960 if (NULL == ego)
961 { 961 {
962 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 962 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failure to obtain ego %s.\n",
963 "Failure to obtain ego. Is identity service running?\n"); 963 GNUNET_h2s (&ego_pub_hash));
964 GNUNET_break (0); 964 GNUNET_break (0);
965 return; 965 return;
966 } 966 }