[memstomp] - Add -q/--quiet options for quiet mode.

Jeffrey Law law at fedoraproject.org
Thu May 30 12:09:59 UTC 2013


commit 004e6f113517bc23c7af735e43584f4eb439cf19
Author: Jeff Law <law at redhat.com>
Date:   Thu May 30 06:09:42 2013 -0600

    - Add -q/--quiet options for quiet mode.

 memstomp-quietmode.patch |   83 ++++++++++++++++++++++++++++++++++++++++++++++
 memstomp.spec            |    7 +++-
 2 files changed, 89 insertions(+), 1 deletions(-)
---
diff --git a/memstomp-quietmode.patch b/memstomp-quietmode.patch
new file mode 100644
index 0000000..727ffed
--- /dev/null
+++ b/memstomp-quietmode.patch
@@ -0,0 +1,83 @@
+diff -Nrup a/memstomp.c b/memstomp.c
+--- a/memstomp.c	2013-05-30 06:02:56.578486389 -0600
++++ b/memstomp.c	2013-05-30 06:06:42.648731070 -0600
+@@ -64,6 +64,8 @@
+ 
+ static bool abrt_trap = false;
+ 
++static bool quiet_mode = false;
++
+ #ifndef SCHED_RESET_ON_FORK
+ /* "Your libc lacks the definition of SCHED_RESET_ON_FORK. We'll now
+  * define it ourselves, however make sure your kernel is new
+@@ -162,7 +164,10 @@ static void setup(void) {
+         if (LIKELY(initialized))
+                 return;
+ 
+-        if (!dlsym(NULL, "main"))
++        if (getenv("MEMSTOMP_QUIET"))
++                quiet_mode = true;
++
++        if (!dlsym(NULL, "main") && !quiet_mode)
+                 fprintf(stderr,
+                         "memstomp: Application appears to be compiled without -rdynamic. It might be a\n"
+                         "memstomp: good idea to recompile with -rdynamic enabled since this produces more\n"
+@@ -173,9 +178,11 @@ static void setup(void) {
+ 
+         initialized = true;
+ 
+-	char prname[17];
+-        fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n",
+-                get_prname(prname), (unsigned long) getpid());
++        if (!quiet_mode) {
++                char prname[17];
++                fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n",
++                        get_prname(prname), (unsigned long) getpid());
++        }
+ }
+ 
+ static void show_summary(void) { }
+diff -Nrup a/memstomp.in b/memstomp.in
+--- a/memstomp.in	2011-03-30 21:27:19.000000000 -0600
++++ b/memstomp.in	2013-05-30 06:06:42.649731067 -0600
+@@ -18,7 +18,7 @@
+ # You should have received a copy of the GNU Lesser General Public
+ # License along with memstomp. If not, see <http://www.gnu.org/licenses/>.
+ 
+-if ! TEMP=`getopt -o +dhk --long help,debug-info,kill -n memstomp -- "$@"` ; then
++if ! TEMP=`getopt -o +dqhk --long help,quiet,debug-info,kill -n memstomp -- "$@"` ; then
+     exit 1
+ fi
+ 
+@@ -38,6 +38,10 @@ while : ; do
+                         shift 1
+                         ;;
+ 
++                -q|--quiet)
++                        export MEMSTOMP_QUIET=1
++                        shift 1
++                        ;;
+ 
+                 -h|--help)
+                         cat <<EOF
+@@ -51,6 +55,7 @@ COMMANDS:
+ OPTIONS:
+   -d, --debug-info                Make use of debug information in stack traces
+   -k, --kill                      Kill application when problem memcpy occurs
++  -q, --quiet                     Be less verbose
+ EOF
+                         exit 0
+                         ;;
+diff -Nrup a/memstomp.man b/memstomp.man
+--- a/memstomp.man	2013-05-30 06:02:56.577486392 -0600
++++ b/memstomp.man	2013-05-30 06:06:18.531812637 -0600
+@@ -47,6 +47,9 @@ Kill the analyzed application when a pro
+ .TP
+ .BR \-h ", " \-\-help
+ Display usage information and exit.
++.TP
++.BR \-q ", " \-\-quiet
++Be less verbose
+ .SH SEE ALSO
+ .BR memcpy (3),
+ .BR memccpy (3),
diff --git a/memstomp.spec b/memstomp.spec
index e9b7c5b..7ee2f87 100644
--- a/memstomp.spec
+++ b/memstomp.spec
@@ -1,7 +1,7 @@
 %global	githash 38573e7d
 Name:		memstomp
 Version:	0.1.4
-Release:	8%{?dist}
+Release:	9%{?dist}
 Summary:	Warns of memory argument overlaps to various functions
 Group:		Development/Debuggers
 # The entire source code is LGPLV3+ with the exception of backtrace-symbols.c which
@@ -22,6 +22,7 @@ Patch0: memstomp-testsuite.patch
 Patch1: memstomp-man.patch
 Patch2: memstomp-rh961495.patch
 Patch3: memstomp-rh962763.patch
+Patch4: memstomp-quietmode.patch
 
 
 %description 
@@ -38,6 +39,7 @@ overlapping memory arguments to certain library calls.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 
 %build
@@ -57,6 +59,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
 %{_mandir}/man1/memstomp.1.gz
 
 %changelog
+* Thu May 30 2013 Jeff Law <law at redhat.com> 0.1.4-9
+- Add -q/--quiet options for quiet mode.
+
 * Tue May 14 2013 Jeff Law <law at redhat.com> 0.1.4-8
 - Link in libiberty too (#962763)
 


More information about the scm-commits mailing list