diff --git a/hplip-mkstemp.patch b/hplip-mkstemp.patch new file mode 100644 index 0000000..f367568 --- /dev/null +++ b/hplip-mkstemp.patch @@ -0,0 +1,46 @@ +diff -up hplip-3.13.5/common/utils.c.mkstemp hplip-3.13.5/common/utils.c +--- hplip-3.13.5/common/utils.c.mkstemp 2013-05-29 15:21:17.210289396 +0100 ++++ hplip-3.13.5/common/utils.c 2013-05-29 15:24:57.214498909 +0100 +@@ -222,8 +222,6 @@ void unload_library(void *pLibHandler) + int createTempFile(char* szFileName, FILE** pFilePtr) + { + char* pFilePos = NULL; +- char szFolderName[64]={0,}; +- struct stat st; + int iFD; + + if (szFileName == NULL || szFileName[0] == '\0' || pFilePtr == NULL) +@@ -235,28 +233,11 @@ int createTempFile(char* szFileName, FIL + if (strstr(szFileName,"XXXXXX") == NULL) + strcat(szFileName,"_XXXXXX"); + +- pFilePos = strrchr(szFileName, '/'); +- if (pFilePos) +- { +- strncpy(szFolderName, szFileName, (pFilePos - szFileName)); +- if(stat(szFolderName,&st) == 0) +- { +- if(st.st_mode & S_IFDIR != 0) +- { +- iFD = mkstemp(szFileName); +- *pFilePtr = fdopen(iFD,"w+"); +- } +- else +- BUG("Insufficient directory [%s] permissions\n",szFolderName); +- } +- else +- BUG("Failed to check directory [%s] errno[%d]\n",szFolderName, errno); +- } ++ iFD = mkstemp(szFileName); ++ if (iFD == -1) ++ BUG("Failed to create tmpfile [%s]: %s\n", szFileName, strerror (errno)); + else +- { +- iFD = mkstemp(szFileName); + *pFilePtr = fdopen(iFD,"w+"); +- } + + return iFD; +-} +\ No newline at end of file ++} diff --git a/hplip.spec b/hplip.spec index 062210c..74d884c 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.13.5 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ and MIT Group: System Environment/Daemons @@ -47,6 +47,7 @@ Patch30: hplip-hpaio-localonly.patch Patch31: hplip-ipp-accessors.patch Patch32: hplip-IEEE-1284-4.patch Patch33: hplip-check.patch +Patch34: hplip-mkstemp.patch %global hpijs_epoch 1 Requires: hpijs%{?_isa} = %{hpijs_epoch}:%{version}-%{release} @@ -297,6 +298,9 @@ done # Various adjustments to make 'hp-check' run more smoothly (bug #683007). %patch33 -p1 -b .check +# Avoid several bugs in createTempFile (bug #925032). +%patch34 -p1 -b .mkstemp + sed -i.duplex-constraints \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \ prnt/drv/hpcups.drv.in @@ -527,6 +531,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %postun libs -p /sbin/ldconfig %changelog +* Wed May 29 2013 Tim Waugh - 3.13.5-2 +- Avoid several bugs in createTempFile (bug #925032). + * Tue May 14 2013 Jiri Popelka - 3.13.5-1 - 3.13.5 - change udev rule to not add printer queue, just check plugin.