Blame SOURCES/memstomp-quietmode.patch

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