diff -up hplip-3.12.11/fax/backend/hpfax.py.logdir hplip-3.12.11/fax/backend/hpfax.py --- hplip-3.12.11/fax/backend/hpfax.py.logdir 2012-11-20 10:55:06.000000000 +0100 +++ hplip-3.12.11/fax/backend/hpfax.py 2012-11-27 10:09:25.298698254 +0100 @@ -244,7 +244,7 @@ else: input_fd = 0 # REVISIT: - tmp_dir = '/var/log/hp/tmp' + tmp_dir = os.environ.get ('TMPDIR', '/var/log/hp/tmp') pipe_name = os.path.join(tmp_dir, "hpfax-pipe-%d" % job_id) diff -up hplip-3.12.11/logcapture.py.logdir hplip-3.12.11/logcapture.py --- hplip-3.12.11/logcapture.py.logdir 2012-11-20 10:55:15.000000000 +0100 +++ hplip-3.12.11/logcapture.py 2012-11-27 10:09:25.298698254 +0100 @@ -39,7 +39,7 @@ CUPS_BACKUP_FILE='/etc/cups/cupsd.conf_o LOG_FOLDER_PATH='./' LOG_FOLDER_NAME='hplip_troubleshoot_logs' LOG_FILES=LOG_FOLDER_PATH + LOG_FOLDER_NAME -TMP_DIR='/var/log/hp/tmp' +TMP_DIR='/var/spool/cups/tmp' ############ enable_log() function ############ #This function changes CUPS conf log level to debug and restarts CUPS service. @@ -268,7 +268,7 @@ if os.path.exists('/var/log/cups/error_l log.error("Failed to capture %s log file."%("/var/log/cups/error_log")) -File_list, File_list_str = utils.expand_list('/var/log/hp/*.log') +File_list, File_list_str = utils.expand_list('%s/*.log'%TMP_DIR) if File_list: sts,out = utils.run('cp -f %s %s'%(File_list_str, LOG_FILES)) if sts != 0: diff -up hplip-3.12.11/prnt/filters/hplipjs.c.logdir hplip-3.12.11/prnt/filters/hplipjs.c --- hplip-3.12.11/prnt/filters/hplipjs.c.logdir 2012-11-20 10:50:44.000000000 +0100 +++ hplip-3.12.11/prnt/filters/hplipjs.c 2012-11-27 10:09:25.299698225 +0100 @@ -275,7 +275,8 @@ int main (int argc, char **argv) { fprintf (stderr, "DEBUG: HPLIPJS: argv[%d] = %s\n", i, argv[i]); } - snprintf(szPSFile, sizeof(szPSFile), "%s/output.ps","/var/log/hp/tmp"); + snprintf(szPSFile, sizeof(szPSFile), "%s/output.ps", + getenv ("TMPDIR") ? : "/var/log/hp/tmp"); HPFp = fopen (szPSFile, "w"); #endif diff -up hplip-3.12.11/prnt/hpcups/HPCupsFilter.cpp.logdir hplip-3.12.11/prnt/hpcups/HPCupsFilter.cpp --- hplip-3.12.11/prnt/hpcups/HPCupsFilter.cpp.logdir 2012-11-27 10:09:25.291698453 +0100 +++ hplip-3.12.11/prnt/hpcups/HPCupsFilter.cpp 2012-11-27 10:13:34.958640524 +0100 @@ -31,16 +31,24 @@ \*****************************************************************************/ #include "HPCupsFilter.h" +#include #include +#include #include #include #include #define HP_FILE_VERSION_STR "03.09.08.0" +char *env_tmpdir = NULL; + static HPCupsFilter filter; int main (int argc, char *argv[]) { + env_tmpdir = getenv ("TMPDIR"); + if (!env_tmpdir) + env_tmpdir = "/var/log/hp/tmp"; + openlog("hpcups", LOG_PID, LOG_DAEMON); if (argc < 6 || argc > 7) { @@ -583,9 +591,10 @@ int HPCupsFilter::processRasterData(cups DRIVER_ERROR err; int ret_status = 0; - char hpPreProcessedRasterFile[64]; //temp file needed to store raster data with swaped pages. + char hpPreProcessedRasterFile[PATH_MAX]; //temp file needed to store raster data with swaped pages. - strcpy(hpPreProcessedRasterFile, "/var/log/hp/tmp/hplipSwapedPagesXXXXXX"); + snprintf(hpPreProcessedRasterFile, sizeof (hpPreProcessedRasterFile), + "%s/hplipSwapedPagesXXXXXX", env_tmpdir); while (cupsRasterReadHeader2(cups_raster, &cups_header)) @@ -647,13 +656,13 @@ int HPCupsFilter::processRasterData(cups if (m_iLogLevel & SAVE_INPUT_RASTERS) { - char szFileName[64]; + char szFileName[PATH_MAX]; memset(szFileName, 0, sizeof(szFileName)); if (cups_header.cupsColorSpace == CUPS_CSPACE_RGBW || cups_header.cupsColorSpace == CUPS_CSPACE_RGB) { - snprintf (szFileName, sizeof(szFileName), "/var/log/hp/tmp/hpcupsfilterc_%d.bmp", current_page_number); + snprintf (szFileName, sizeof(szFileName), "%s/hpcupsfilterc_%d.bmp", env_tmpdir, current_page_number); cfp = fopen (szFileName, "w"); chmod (szFileName, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } @@ -661,7 +670,7 @@ int HPCupsFilter::processRasterData(cups if (cups_header.cupsColorSpace == CUPS_CSPACE_RGBW || cups_header.cupsColorSpace == CUPS_CSPACE_K) { - snprintf (szFileName, sizeof(szFileName), "/var/log/hp/tmp/hpcupsfilterk_%d.bmp", current_page_number); + snprintf (szFileName, sizeof(szFileName), "%s/hpcupsfilterk_%d.bmp", env_tmpdir, current_page_number); kfp = fopen (szFileName, "w"); chmod (szFileName, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } diff -up hplip-3.12.11/prnt/hpcups/LJZjStream.cpp.logdir hplip-3.12.11/prnt/hpcups/LJZjStream.cpp --- hplip-3.12.11/prnt/hpcups/LJZjStream.cpp.logdir 2012-11-20 10:49:20.000000000 +0100 +++ hplip-3.12.11/prnt/hpcups/LJZjStream.cpp 2012-11-27 10:16:24.878547224 +0100 @@ -42,9 +42,12 @@ #include "LJZjStream.h" #include "Utils.h" #include "hpjbig_wrapper.h" +#include #define ZJC_BAND_HEIGHT 100 +extern char *env_tmpdir; + LJZjStream::LJZjStream () : Encapsulator () { memset(&m_PM, 0, sizeof(m_PM)); @@ -675,10 +678,10 @@ DRIVER_ERROR LJZjStream::preProcessRaste cups_raster_t *even_pages_raster=NULL; cups_raster_t *odd_pages_raster = NULL; BYTE* pPageDataBuffer = NULL; - char hpEvenPagesFile[64]={0,}; - char hpOddPagesFile[64]={0,}; - snprintf(hpEvenPagesFile, sizeof(hpEvenPagesFile), "%s/hplipEvenPagesXXXXXX","/var/log/hp/tmp"); - snprintf(hpOddPagesFile, sizeof(hpOddPagesFile), "%s/hplipOddPagesXXXXXX", "/var/log/hp/tmp"); + char hpEvenPagesFile[PATH_MAX]={0,}; + char hpOddPagesFile[PATH_MAX]={0,}; + snprintf(hpEvenPagesFile, sizeof(hpEvenPagesFile), "%s/hplipEvenPagesXXXXXX", env_tmpdir); + snprintf(hpOddPagesFile, sizeof(hpOddPagesFile), "%s/hplipOddPagesXXXXXX", env_tmpdir); if (1 != m_pJA->pre_process_raster || !firstpage_cups_header->Duplex){ return NO_ERROR; diff -up hplip-3.12.11/prnt/hpcups/SystemServices.cpp.logdir hplip-3.12.11/prnt/hpcups/SystemServices.cpp --- hplip-3.12.11/prnt/hpcups/SystemServices.cpp.logdir 2012-11-20 10:49:20.000000000 +0100 +++ hplip-3.12.11/prnt/hpcups/SystemServices.cpp 2012-11-27 10:09:25.300698197 +0100 @@ -30,14 +30,17 @@ #include "CommonDefinitions.h" #include "SystemServices.h" +#include + +extern char *env_tmpdir; SystemServices::SystemServices(int iLogLevel, int job_id) : m_iLogLevel(iLogLevel) { m_fp = NULL; if (iLogLevel & SAVE_PCL_FILE) { - char fname[64]; - sprintf(fname, "%s/hpcups_job%d.out", "/var/log/hp/tmp",job_id); + char fname[PATH_MAX]; + sprintf(fname, "%s/hpcups_job%d.out", env_tmpdir, job_id); m_fp = fopen(fname, "w"); chmod(fname, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } diff -up hplip-3.12.11/prnt/hpijs/hpcupsfax.cpp.logdir hplip-3.12.11/prnt/hpijs/hpcupsfax.cpp --- hplip-3.12.11/prnt/hpijs/hpcupsfax.cpp.logdir 2012-11-20 10:50:48.000000000 +0100 +++ hplip-3.12.11/prnt/hpijs/hpcupsfax.cpp 2012-11-27 10:09:25.300698197 +0100 @@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. \*****************************************************************************/ +#include #include #include #include @@ -66,6 +67,7 @@ uint16_t (*convert_endian_s)(uint16_t); static int iLogLevel = 1; char hpFileName[64] ; +static char *env_tmpdir; #define TIFF_HDR_SIZE 8 #define LITTLE_ENDIAN_MODE I @@ -439,9 +441,9 @@ int ProcessTiffData(int fromFD, int toFD int bytes_written = 0; int ret_status = 0; int bytes_read = 0; - char hpTiffFileName[64]; + char hpTiffFileName[PATH_MAX]; long input_file_size = 0; - snprintf(hpTiffFileName,sizeof(hpTiffFileName), "%s/hpliptiffXXXXXX","/var/log/hp/tmp"); + snprintf(hpTiffFileName,sizeof(hpTiffFileName), "%s/hpliptiffXXXXXX",env_tmpdir); fdTiff = mkstemp (hpTiffFileName); @@ -656,6 +658,10 @@ int main (int argc, char **argv) /*********** PROLOGUE ***********/ + env_tmpdir = getenv ("TMPDIR"); + if (!env_tmpdir) + env_tmpdir = "/var/log/hp/tmp"; + GetLogLevel(); openlog("hpcupsfax", LOG_PID, LOG_DAEMON); @@ -679,7 +685,7 @@ int main (int argc, char **argv) i++; } - snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxLog_XXXXXX","/var/log/hp/tmp"); + snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxLog_XXXXXX",env_tmpdir); fdFax = mkstemp (hpFileName); if (fdFax < 0) diff -up hplip-3.12.11/prnt/hpijs/hpijs.cpp.logdir hplip-3.12.11/prnt/hpijs/hpijs.cpp --- hplip-3.12.11/prnt/hpijs/hpijs.cpp.logdir 2012-11-27 10:09:25.288698537 +0100 +++ hplip-3.12.11/prnt/hpijs/hpijs.cpp 2012-11-27 10:09:25.301698169 +0100 @@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. \*****************************************************************************/ +#include #include #include #include @@ -43,6 +44,8 @@ #include "hpijs.h" #include "services.h" +static char *env_tmpdir; + extern void SendDbusMessage (const char *dev, const char *printer, int code, const char *username, const int jobid, const char *title); @@ -96,8 +99,8 @@ void setLogLevel(UXServices *pSS) if (pSS->m_iLogLevel & SAVE_PCL_FILE) { - char szFileName[64]; - snprintf (szFileName,sizeof(szFileName), "/var/log/hp/tmp/hpijs_%d.out", getpid()); + char szFileName[PATH_MAX]; + snprintf (szFileName,sizeof(szFileName), "%s/hpijs_%d.out", env_tmpdir, getpid()); pSS->outfp = fopen (szFileName, "w"); if (pSS->outfp) @@ -588,6 +591,10 @@ int main (int argc, char *argv[], char * int ret, n, i, kn=0, width, k_width; int low_marker = 0; + env_tmpdir = getenv ("TMPDIR"); + if (!env_tmpdir) + env_tmpdir = "/var/log/hp/tmp"; + openlog("hpijs", LOG_PID, LOG_DAEMON); if (argc > 1) @@ -627,8 +634,8 @@ int main (int argc, char *argv[], char * setLogLevel(pSS); #ifdef CAPTURE - char szCapOutFile[64]; - snprintf(szCapOutFile, sizeof(szCapOutFile),"%s/capout_XXXXXX","/var/log/hp/tmp"); + char szCapOutFile[PATH_MAX]; + snprintf(szCapOutFile, sizeof(szCapOutFile),"%s/capout_XXXXXX",env_tmpdir); if ((pSS->InitScript(szCapOutFile, TRUE)) != NO_ERROR) BUG("unable to init capture"); #endif diff -up hplip-3.12.11/prnt/hpijs/hpijsfax.cpp.logdir hplip-3.12.11/prnt/hpijs/hpijsfax.cpp --- hplip-3.12.11/prnt/hpijs/hpijsfax.cpp.logdir 2012-11-20 10:50:48.000000000 +0100 +++ hplip-3.12.11/prnt/hpijs/hpijsfax.cpp 2012-11-27 10:09:25.301698169 +0100 @@ -31,6 +31,7 @@ #ifdef HAVE_LIBHPIP +#include #include #include #include @@ -270,14 +271,15 @@ int hpijsFaxServer (int argc, char **arg IP_IMAGE_TRAITS traits; IP_HANDLE hJob; - char hpFileName[64]; + char hpFileName[PATH_MAX]; int fdFax = -1; BYTE szFileHeader[68]; BYTE szPageHeader[64]; BYTE *p; unsigned int uiPageNum = 0; - snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxXXXXXX","/var/log/hp/tmp"); + snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxXXXXXX", + getenv ("TMPDIR") ? : "/var/log/hp/tmp"); pFaxStruct = new HPIJSFax ();