Blame SOURCES/memstomp-quietmode.patch

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