Blame SOURCES/memstomp-quietmode.patch

e165a3
diff -Nrup a/memstomp.c b/memstomp.c
e165a3
--- a/memstomp.c	2013-05-30 06:02:56.578486389 -0600
e165a3
+++ b/memstomp.c	2013-05-30 06:06:42.648731070 -0600
e165a3
@@ -64,6 +64,8 @@
e165a3
 
e165a3
 static bool abrt_trap = false;
e165a3
 
e165a3
+static bool quiet_mode = false;
e165a3
+
e165a3
 #ifndef SCHED_RESET_ON_FORK
e165a3
 /* "Your libc lacks the definition of SCHED_RESET_ON_FORK. We'll now
e165a3
  * define it ourselves, however make sure your kernel is new
e165a3
@@ -162,7 +164,10 @@ static void setup(void) {
e165a3
         if (LIKELY(initialized))
e165a3
                 return;
e165a3
 
e165a3
-        if (!dlsym(NULL, "main"))
e165a3
+        if (getenv("MEMSTOMP_QUIET"))
e165a3
+                quiet_mode = true;
e165a3
+
e165a3
+        if (!dlsym(NULL, "main") && !quiet_mode)
e165a3
                 fprintf(stderr,
e165a3
                         "memstomp: Application appears to be compiled without -rdynamic. It might be a\n"
e165a3
                         "memstomp: good idea to recompile with -rdynamic enabled since this produces more\n"
e165a3
@@ -173,9 +178,11 @@ static void setup(void) {
e165a3
 
e165a3
         initialized = true;
e165a3
 
e165a3
-	char prname[17];
e165a3
-        fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n",
e165a3
-                get_prname(prname), (unsigned long) getpid());
e165a3
+        if (!quiet_mode) {
e165a3
+                char prname[17];
e165a3
+                fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n",
e165a3
+                        get_prname(prname), (unsigned long) getpid());
e165a3
+        }
e165a3
 }
e165a3
 
e165a3
 static void show_summary(void) { }
e165a3
diff -Nrup a/memstomp.in b/memstomp.in
e165a3
--- a/memstomp.in	2011-03-30 21:27:19.000000000 -0600
e165a3
+++ b/memstomp.in	2013-05-30 06:06:42.649731067 -0600
e165a3
@@ -18,7 +18,7 @@
e165a3
 # You should have received a copy of the GNU Lesser General Public
e165a3
 # License along with memstomp. If not, see <http://www.gnu.org/licenses/>.
e165a3
 
e165a3
-if ! TEMP=`getopt -o +dhk --long help,debug-info,kill -n memstomp -- "$@"` ; then
e165a3
+if ! TEMP=`getopt -o +dqhk --long help,quiet,debug-info,kill -n memstomp -- "$@"` ; then
e165a3
     exit 1
e165a3
 fi
e165a3
 
e165a3
@@ -38,6 +38,10 @@ while : ; do
e165a3
                         shift 1
e165a3
                         ;;
e165a3
 
e165a3
+                -q|--quiet)
e165a3
+                        export MEMSTOMP_QUIET=1
e165a3
+                        shift 1
e165a3
+                        ;;
e165a3
 
e165a3
                 -h|--help)
e165a3
                         cat <
e165a3
@@ -51,6 +55,7 @@ COMMANDS:
e165a3
 OPTIONS:
e165a3
   -d, --debug-info                Make use of debug information in stack traces
e165a3
   -k, --kill                      Kill application when problem memcpy occurs
e165a3
+  -q, --quiet                     Be less verbose
e165a3
 EOF
e165a3
                         exit 0
e165a3
                         ;;
e165a3
diff -Nrup a/memstomp.man b/memstomp.man
e165a3
--- a/memstomp.man	2013-05-30 06:02:56.577486392 -0600
e165a3
+++ b/memstomp.man	2013-05-30 06:06:18.531812637 -0600
e165a3
@@ -47,6 +47,9 @@ Kill the analyzed application when a pro
e165a3
 .TP
e165a3
 .BR \-h ", " \-\-help
e165a3
 Display usage information and exit.
e165a3
+.TP
e165a3
+.BR \-q ", " \-\-quiet
e165a3
+Be less verbose
e165a3
 .SH SEE ALSO
e165a3
 .BR memcpy (3),
e165a3
 .BR memccpy (3),