[gnome-color-manager] Do not crash attempting to add cups printers without PPD file
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Do not crash attempting to add cups printers without PPD file
- Date: Mon, 1 Mar 2010 17:55:04 +0000 (UTC)
commit 1fe33100dd3ea243e8e4c79906daae7c87bea392
Author: Martin Szulecki <opensuse sukimashita com>
Date: Mon Mar 1 18:45:17 2010 +0100
Do not crash attempting to add cups printers without PPD file
CUPS allows custom backends for virtual printer devices and some
software use this for adding fax printers for instance. Such devices
have no PPD file associated thus attempting to access it is going to
fail and crash in this case.
src/gcm-device-cups.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-device-cups.c b/src/gcm-device-cups.c
index 4929c78..6f1fb7b 100644
--- a/src/gcm-device-cups.c
+++ b/src/gcm-device-cups.c
@@ -84,10 +84,17 @@ gcm_device_cups_set_from_dest (GcmDevice *device, http_t *http, cups_dest_t dest
}
ppd_file_location = cupsGetPPD2 (http, dest.name);
- ppd_file = ppdOpenFile (ppd_file_location);
-
egg_debug ("ppd_file_location=%s", ppd_file_location);
+ /* don't add devices without PPD */
+ if (ppd_file_location == NULL) {
+ g_set_error (error, 1, 0, "Not adding device without PPD");
+ ret = FALSE;
+ goto out;
+ }
+
+ ppd_file = ppdOpenFile (ppd_file_location);
+
for (i = 0; i < ppd_file->num_attrs; i++) {
const gchar *keyword;
const gchar *value;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]