- Prevent crash when DEVICE_URI/PRINTER environment variables are not set

(bug #479808 comment 6).
This commit is contained in:
Tim Waugh 2009-01-13 15:20:09 +00:00
parent 446491af41
commit cf3ca3100d
2 changed files with 29 additions and 1 deletions

19
hplip-segfault.patch Normal file
View File

@ -0,0 +1,19 @@
diff -up hplip-2.8.12/prnt/hpijs/hpijs.cpp.segfault hplip-2.8.12/prnt/hpijs/hpijs.cpp
--- hplip-2.8.12/prnt/hpijs/hpijs.cpp.segfault 2009-01-13 15:11:55.000000000 +0000
+++ hplip-2.8.12/prnt/hpijs/hpijs.cpp 2009-01-13 15:13:49.000000000 +0000
@@ -231,8 +231,14 @@ int hpijs_set_cb (void *set_cb_data, Ijs
// call dbus here
const char *user_name = " ";
const char *title = " ";
+ char *device_uri = getenv ("DEVICE_URI");
+ char *printer = getenv("PRINTER");
int job_id = 0;
- SendDbusMessage (getenv ("DEVICE_URI"), getenv("PRINTER"),
+ if (!device_uri)
+ device_uri = "";
+ if (!printer)
+ printer = "";
+ SendDbusMessage (device_uri, printer,
EVENT_PRINT_FAILED_MISSING_PLUGIN,
user_name, job_id, title);
bug("unable to set device=%s, err=%d\n", svalue, r);

View File

@ -1,7 +1,7 @@
Summary: HP Linux Imaging and Printing Project Summary: HP Linux Imaging and Printing Project
Name: hplip Name: hplip
Version: 2.8.12 Version: 2.8.12
Release: 3%{?dist} Release: 4%{?dist}
License: GPLv2+ and MIT License: GPLv2+ and MIT
Group: System Environment/Daemons Group: System Environment/Daemons
Conflicts: system-config-printer < 0.6.132 Conflicts: system-config-printer < 0.6.132
@ -15,6 +15,7 @@ Url: http://hplip.sourceforge.net/
Source0: http://kent.dl.sourceforge.net/sourceforge/hplip/%{name}-%{version}.tar.gz Source0: http://kent.dl.sourceforge.net/sourceforge/hplip/%{name}-%{version}.tar.gz
Source1: hplip.fdi Source1: hplip.fdi
Patch1: hplip-desktop.patch Patch1: hplip-desktop.patch
Patch2: hplip-segfault.patch
Patch4: hplip-marker-supply.patch Patch4: hplip-marker-supply.patch
Patch5: hplip-dbus.patch Patch5: hplip-dbus.patch
Patch6: hplip-systray.patch Patch6: hplip-systray.patch
@ -104,6 +105,10 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version}
# Fix desktop file. # Fix desktop file.
%patch1 -p1 -b .desktop %patch1 -p1 -b .desktop
# Prevent crash when DEVICE_URI/PRINTER environment variables are not
# set (bug #479808 comment 6).
%patch2 -p1 -b .segfault
# Low ink is a warning condition, not an error. # Low ink is a warning condition, not an error.
%patch4 -p1 -b .marker-supply %patch4 -p1 -b .marker-supply
@ -317,6 +322,10 @@ fi
exit 0 exit 0
%changelog %changelog
* Tue Jan 13 2009 Tim Waugh <twaugh@redhat.com> 2.8.12-4
- Prevent crash when DEVICE_URI/PRINTER environment variables are not
set (bug #479808 comment 6).
* Tue Jan 13 2009 Tim Waugh <twaugh@redhat.com> 2.8.12-3 * Tue Jan 13 2009 Tim Waugh <twaugh@redhat.com> 2.8.12-3
- Make --qt4 the default for the systray applet, so that it appears - Make --qt4 the default for the systray applet, so that it appears
in the right place, again (bug #479751). in the right place, again (bug #479751).