[cups-devel] [UNKN] STR #4547: Wrong tmp file name on Windows

Olivier Levon noreply at cups.org
Thu Dec 25 07:18:21 PST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Just compiled ippserver on Windows with VC 2015.

First run, gave me following output :

C:\Users\Olivier\Desktop\mDNSResponder-544_git - Copie\3rd
party\cupsg\vcnet\Win32\Debug>ippserver.exe -v discus_cups201win32
Listening on port 8631.
Unable to create spool directory "/tmp/ippserver.312": No such file or
directory
Usage: ippserver [options] "name"

Options:
- -2                      Supports 2-sided printing (default=1-sided)
- -M manufacturer         Manufacturer name (default=Test)
- -P                      PIN printing mode
- -c command              Run command for every print job
- -d spool-directory      Spool directory (default=/tmp/ippserver.312)
- -f type/subtype[,...]   List of supported types
(default=application/pdf,image/jpeg)
- -h                      Show program help
- -i iconfile.png         PNG icon file (default=printer.png)
- -k                      Keep job spool files
- -l location             Location of printer (default=empty string)
- -m model                Model name (default=Printer)
- -n hostname             Hostname for printer
- -p port                 Port number (default=auto)
- -r subtype              Bonjour service subtype (default=_print)
- -s speed[,color-speed]  Speed in pages per minute (default=10,0)
- -v[vvv]                 Be (very) verbose

You can't use tmp file nane of kind /tmp/ippserver on Windows. In
ippserver.c, you should replace line 633 by following code :

#ifdef WIN32
	{	  
		char environmentBuffer[ MAX_PATH ] = "";
		GetEnvironmentVariable("TEMP", environmentBuffer,
sizeof(environmentBuffer));
		snprintf(directory, sizeof(directory), "%s\\ippserver.%d",
environmentBuffer, (int)getpid());
	}
#else
    snprintf(directory, sizeof(directory), "/tmp/ippserver.%d",
(int)getpid());
#endif /* WIN32 */

or :

#ifdef WIN32
	  {
		  char environmentBuffer[MAX_PATH] = "";
		  // Gets the temp path env string (no guarantee it's a valid path).
		  GetTempPath(MAX_PATH, environmentBuffer);
		  snprintf(directory, sizeof(directory), "%s\ippserver.%d",
environmentBuffer, (int)getpid());
	  }
#else
	  snprintf(directory, sizeof(directory), "/tmp/ippserver.%d",
(int)getpid());
#endif /* WIN32 */


More informations can be found here :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683188%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx

With VC 2015, I had to desactivate Unicode support

Link: https://www.cups.org/str.php?L4547
Version: 2.0-current
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJUnCq9AAoJENujp6sI12Ij67AP/2BS8p62JFihtP3GiywPrE+v
0U5SfBOtUczv9vIi7QHyn762/txYWcJMlQAuCSDZ/NWOXoKm6lxKAHeFoj+Vzmmx
2n0zWW/QSX+wx9v+oHRdvY98obuyL6XJBOW1duf/voj8/NgaLfJIeuQHMhGgbAup
Bj930qAHa3AlFPj4pna8g1lr2UbhgV1yx26Y80IZqoZOWPOLBzLUqLmhEL9NvNSr
VXCDZf5Kzj/98PYsHOZBbW4+w8X1YNPsVmX7yHvWG/18Bbl2iWAPVbfJsRv9XNWL
em5B1B6uFinDsJnXoCWi/D8daLR6yqdNxIRTQ2MkKUHhajrhffbHtz9pCiUwGZRw
S/bYnXWGIdiMJLMBGJlgDPQfsS+tI9hvUwJ3gepOoHqEmtsyITCDnrWC8MBuKbQz
rXPpvwGE2WSSm7akm0ifkQX/ba4rKdYuY5GSUWoZ74ZthjEKYXfP/KeCCMRKIP8c
CXHcua4fxtoMtIlxPzzC+D4axnu2Rl+zUjyIEX1TJRXSUcraVqCABfjMf6K4neOa
y0JTlJyxoUMunM2hCoPtWIh5WvaJgSaEJGZP6YE6RSEmWnbc0GzepSUTcrntdUgM
AYqOMeFV5uyPua1+Z8MzCPi1BQvQUtYfgn7Q+Swpy2VdeOM3GWRNIGgjzmlgiJi4
8oZMs6nDi4679NCXyfh0
=kkQg
-----END PGP SIGNATURE-----




More information about the cups mailing list