Hi Raúl,

I wrote:
> Does it fix your problem if you skip the call to smclog() and execute
> the write() and close() statements only when open() didn't change errno
> to 13 (EACCES) as in the attached patch?

The patch from the previous message was buggy: It wrote to the opened
file only in case the open() failed. The attached patch fixes this.
Please try it with the patch attached to *this* message instead.

Regards
  Micha
Index: mroute-api.c
===================================================================
--- mroute-api.c	(Revision 66)
+++ mroute-api.c	(Arbeitskopie)
@@ -277,11 +277,13 @@
     char * file = "/proc/sys/net/ipv6/conf/all/mc_forwarding";
     
     fd = open( file, O_WRONLY );
-    if ( fd < 0 )  
-      smclog( LOG_ERR, errno, "open(%s)", file);  
-
-    (void) write( fd, "1", 1 );
-    (void) close( fd );
+    if ( fd < 0 ) {
+      if ( errno != EACCES )
+        smclog( LOG_ERR, errno, "open(%s)", file);  
+    } else {
+      (void) write( fd, "1", 1 );
+      (void) close( fd );
+    }
   }
   return 0;
 #endif /* HAVE_IPV6_MULTICAST_ROUTING */

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to