Avoid several bugs in createTempFile (bug #925032).
This commit is contained in:
parent
f3f0e69c91
commit
d997917a78
46
hplip-mkstemp.patch
Normal file
46
hplip-mkstemp.patch
Normal file
@ -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
|
||||
+}
|
||||
@ -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 <twaugh@redhat.com> - 3.13.5-2
|
||||
- Avoid several bugs in createTempFile (bug #925032).
|
||||
|
||||
* Tue May 14 2013 Jiri Popelka <jpopelka@redhat.com> - 3.13.5-1
|
||||
- 3.13.5
|
||||
- change udev rule to not add printer queue, just check plugin.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user