gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37258 - in gnunet: contrib src/social


From: gnunet
Subject: [GNUnet-SVN] r37258 - in gnunet: contrib src/social
Date: Thu, 9 Jun 2016 16:36:14 +0200

Author: lynx
Date: 2016-06-09 16:36:14 +0200 (Thu, 09 Jun 2016)
New Revision: 37258

Modified:
   gnunet/contrib/gnunet-logread
   gnunet/src/social/social_api.c
Log:
improved usability for gnunet-logread -f

Modified: gnunet/contrib/gnunet-logread
===================================================================
--- gnunet/contrib/gnunet-logread       2016-06-08 19:23:02 UTC (rev 37257)
+++ gnunet/contrib/gnunet-logread       2016-06-09 14:36:14 UTC (rev 37258)
@@ -31,9 +31,13 @@
     -m <regex>                 Only pass messages matching a regular 
expression.
 X
 
+use POSIX qw(mkfifo);
+
 use Term::ANSIColor qw(:constants :pushpop);
 $Term::ANSIColor::AUTOLOCAL = 1;
 
+my %levels = ( NONE => 0, ERROR => 1, WARNING => 2, INFO => 4, DEBUG => 8 );
+
 # Message type numbers to names
 my %msgtypes;
 my $prefix = $ENV{GNUNET_PREFIX} || '/usr';
@@ -57,10 +61,19 @@
 X
 }
 
-my %levels = ( NONE => 0, ERROR => 1, WARNING => 2, INFO => 4, DEBUG => 8 );
-if (exists $opts{n})
-{
-    die "You can't read and write the socket at the same time" if exists 
$opts{f};
+die "You can't read and write the socket at the same time"
+  if exists $opts{f} and exists $opts{n};
+
+if ((exists $opts{n} or exists $opts{f}) and not -r $ipc) {
+    undef $!;
+    die "Could not mkfifo $ipc: $!" unless mkfifo $ipc, 0600;
+    system('chgrp', 'gnunet', $ipc);
+    die "Could not chgrp $ipc to 'gnunet': $!" if $!;
+    chmod 0660, $ipc;
+    die "Could not chmod $ipc to allow gnunet group writes: $!" if $!;
+}
+
+if (exists $opts{n}) {
     $name = $opts{n};
     $msg_level = $opts{L} && exists $levels{$opts{L}} ? $levels{$opts{L}} : 0;
     $msg_regex = $opts{m};
@@ -69,7 +82,6 @@
 }
 
 if (exists $opts{f}) {
-    system('/bin/mkfifo', $ipc) unless -r $ipc;
     open(I, $ipc) or die "Cannot read from $ipc: $!";
     &perform while <I>;
     close I;

Modified: gnunet/src/social/social_api.c
===================================================================
--- gnunet/src/social/social_api.c      2016-06-08 19:23:02 UTC (rev 37257)
+++ gnunet/src/social/social_api.c      2016-06-09 14:36:14 UTC (rev 37258)
@@ -959,8 +959,8 @@
     ego = GNUNET_CONTAINER_multihashmap_get (app->egos, &ego_pub_hash);
   if (NULL == ego)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Failure to obtain ego. Is identity service running?\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failure to obtain ego %s.\n",
+               GNUNET_h2s (&ego_pub_hash));
     GNUNET_break (0);
     return;
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]