[gpsd] don't crash in gpscat when started without arguments (#633117)
Miroslav Lichvar
mlichvar at fedoraproject.org
Tue Sep 14 16:15:22 UTC 2010
commit bf752c4e1feee776e005ed4004155ee055639fb8
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date: Tue Sep 14 17:48:37 2010 +0200
don't crash in gpscat when started without arguments (#633117)
gpsd-2.95-gpscatnoarg.patch | 66 +++++++++++++++++++++++++++++++++++++++++++
gpsd.spec | 7 ++++-
2 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/gpsd-2.95-gpscatnoarg.patch b/gpsd-2.95-gpscatnoarg.patch
new file mode 100644
index 0000000..10455e0
--- /dev/null
+++ b/gpsd-2.95-gpscatnoarg.patch
@@ -0,0 +1,66 @@
+From ba90cdad2cc759e2b5ebb91fa374e57a868f142c Mon Sep 17 00:00:00 2001
+From: Miroslav Lichvar <mlichvar at redhat.com>
+Date: Mon, 13 Sep 2010 15:16:17 +0200
+Subject: [PATCH 1/2] Don't crash in gpscat when started without arguments.
+
+---
+ gpscat | 9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/gpscat b/gpscat
+index f51cacb..1fe98dd 100755
+--- a/gpscat
++++ b/gpscat
+@@ -31,6 +31,9 @@ def reporter(errlevel, msg):
+ if errlevel <= debuglevel:
+ sys.stdout.write(msg)
+
++def printusage():
++ sys.stderr.write("usage: gpscat [-s speed] serial-port\n")
++
+ if __name__ == '__main__':
+ buf = ""
+ try:
+@@ -60,9 +63,13 @@ if __name__ == '__main__':
+ elif switch == '-D':
+ debuglevel = BASELEVEL + int(val)
+ elif switch == '-h':
+- sys.stderr.write("usage: gpscat [-s speed] serial-port\n")
++ printusage()
+ raise SystemExit, 0
+
++ if (len(arguments) != 1):
++ printusage()
++ raise SystemExit, 1
++
+ if "rfcomm" in arguments[0]: # Bluetooth special case
+ s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
+ s.connect((arguments[0], 1))
+--
+1.7.2
+
+From 65a5b756eff38741cdb41851f8a2eaeaae1a0094 Mon Sep 17 00:00:00 2001
+From: Miroslav Lichvar <mlichvar at redhat.com>
+Date: Mon, 13 Sep 2010 15:19:00 +0200
+Subject: [PATCH 2/2] Update gpscat usage text.
+
+---
+ gpscat | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/gpscat b/gpscat
+index 1fe98dd..9e02084 100755
+--- a/gpscat
++++ b/gpscat
+@@ -32,7 +32,7 @@ def reporter(errlevel, msg):
+ sys.stdout.write(msg)
+
+ def printusage():
+- sys.stderr.write("usage: gpscat [-s speed] serial-port\n")
++ sys.stderr.write("usage: gpscat [-s speed] [-p] [-t] [-D debuglevel] serial-port\n")
+
+ if __name__ == '__main__':
+ buf = ""
+--
+1.7.2
+
diff --git a/gpsd.spec b/gpsd.spec
index 423b39a..7fc7bfb 100644
--- a/gpsd.spec
+++ b/gpsd.spec
@@ -2,7 +2,7 @@
Name: gpsd
Version: 2.95
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Service daemon for mediating access to a GPS
Group: System Environment/Daemons
@@ -13,6 +13,7 @@ Source10: gpsd.init
Source11: gpsd.sysconfig
Patch0: gpsd-2.95-silentmake.patch
Patch1: gpsd-2.95-hotplugvars.patch
+Patch2: gpsd-2.95-gpscatnoarg.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: dbus-devel dbus-glib-devel ncurses-devel xmlto python-devel
@@ -70,6 +71,7 @@ can run on a serial terminal or terminal emulator.
%setup -q
%patch0 -p1 -b .silentmake
%patch1 -p1 -b .hotplugvars
+%patch2 -p1 -b .gpscatnoarg
%build
%configure \
@@ -202,6 +204,9 @@ fi
%changelog
+* Tue Sep 14 2010 Miroslav Lichvar <mlichvar at redhat.com> - 2.95-4
+- don't crash in gpscat when started without arguments (#633117)
+
* Fri Aug 27 2010 Dan Horák <dan[at]danny.cz> - 2.95-3
- no USB on s390(x)
More information about the scm-commits
mailing list