Fix code which looked for leaked FDs between each command.
authorRichard Jones <rjones@trick.home.annexia.org>
Thu, 17 Sep 2009 15:44:20 +0000 (16:44 +0100)
committerRichard Jones <rjones@trick.home.annexia.org>
Thu, 17 Sep 2009 15:58:09 +0000 (16:58 +0100)
This code was not checking the return value from system()
so it failed if uncommented.  Add ignore_value() around the
call to system.  However, leave the code still disabled.

daemon/m4/gnulib-cache.m4
daemon/proto.c

index ea499d8..bd6cf61 100644 (file)
 
 
 # Specification in the form of a command-line invocation:
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl hash manywarnings warnings
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl hash ignore-value manywarnings warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   hash
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   hash
+  ignore-value
   manywarnings
   warnings
 ])
   manywarnings
   warnings
 ])
index c0e3927..c22bbee 100644 (file)
@@ -29,6 +29,8 @@
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 
+#include "ignore-value.h"
+
 #include "daemon.h"
 #include "../src/guestfs_protocol.h"
 
 #include "daemon.h"
 #include "../src/guestfs_protocol.h"
 
@@ -53,13 +55,11 @@ main_loop (int _sock)
   sock = _sock;
 
   for (;;) {
   sock = _sock;
 
   for (;;) {
-#if 0
     /* Most common errors are leaked memory and leaked file descriptors,
      * so run this between each command:
      */
     /* Most common errors are leaked memory and leaked file descriptors,
      * so run this between each command:
      */
-    if (verbose)
-      system ("ls -l /proc/self/fd");
-#endif
+    if (verbose && 0)
+      ignore_value (system ("ls -l /proc/self/fd"));
 
     /* Read the length word. */
     if (xread (sock, lenbuf, 4) == -1)
 
     /* Read the length word. */
     if (xread (sock, lenbuf, 4) == -1)