hplip/hplip-openPPD.patch

25 lines
803 B
Diff

diff -up hplip-3.10.2/prnt/cupsext/cupsext.c.openPPD hplip-3.10.2/prnt/cupsext/cupsext.c
--- hplip-3.10.2/prnt/cupsext/cupsext.c.openPPD 2010-02-25 00:04:58.000000000 +0100
+++ hplip-3.10.2/prnt/cupsext/cupsext.c 2010-03-17 19:54:19.000000000 +0100
@@ -1221,9 +1221,18 @@ PyObject * openPPD( PyObject * self, PyO
return Py_BuildValue( "" ); // None
}
- g_ppd_file = cupsGetPPD( ( const char * ) printer );
+ if ( ( g_ppd_file = cupsGetPPD( ( const char * ) printer ) ) == NULL )
+ {
+ goto bailout;
+ }
+
+ if ( ( file = fopen( g_ppd_file, "r" )) == NULL )
+ {
+ unlink(g_ppd_file);
+ g_ppd_file = NULL;
+ goto bailout;
+ }
- file = fopen( g_ppd_file, "r" );
ppd = ppdOpen( file );
ppdLocalize( ppd );
fclose( file );