Blame SOURCES/memstomp-quietmode.patch

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