File LPRng-3.8.28-tmpdir.diff of Package lprng
--- src/common/linelist.c
+++ src/common/linelist.c
@@ -11,6 +11,7 @@
"$Id: linelist.c,v 1.65 2004/02/04 00:54:11 papowell Exp $";
#include "lp.h"
+#include "defs.h"
#include "errorcodes.h"
#include "globmatch.h"
#include "gethostinfo.h"
@@ -2390,6 +2391,7 @@
/* do not worry if these fail */
close( intempfd); intempfd = -1;
close( outtempfd); outtempfd = -1;
+ Remove_tempfiles();
}
}
@@ -2505,7 +2507,8 @@
struct stat statb;
if( Is_server ){
- if( dir == 0 ) dir = Spool_dir_DYN;
+ // only create tempfiles in spooldir when already expanded
+ if( (dir == 0) && safestrcmp(Spool_dir_DYN,SD_DEFAULT "/%P")) dir = Spool_dir_DYN;
if( dir == 0 ) dir = Server_tmp_dir_DYN;
} else {
dir = getenv( "LPR_TMP" );
--- src/common/vars.c.orig 2008-02-28 16:50:32.000000000 +0100
+++ src/common/vars.c 2008-02-28 16:51:15.000000000 +0100
@@ -200,7 +200,7 @@ struct keywords Pc_var_list[] = {
/* default remote host */
{ "default_remote_host", 0, STRING_K, &Default_remote_host_DYN,0,0,"=localhost"},
/* default temp directory for temp files */
-{ "default_tmp_dir", 0, STRING_K, &Default_tmp_dir_DYN,0,0,"=/tmp"},
+{ "default_tmp_dir", 0, STRING_K, &Default_tmp_dir_DYN,0,0,"=/var/tmp"},
/* printers that we should query for status information */
{ "destinations", 0, STRING_K, &Destinations_DYN,0,0,0},
/* allow LPR to make direct socket connection to printer */
@@ -492,7 +492,7 @@ struct keywords Pc_var_list[] = {
/* allow mail to user using the sendmail program */
{ "sendmail_to_user", 0, FLAG_K, &Sendmail_to_user_DYN,0,0,"=1"},
/* server temporary file directory */
-{ "server_tmp_dir", 0, STRING_K, &Server_tmp_dir_DYN,0,0,"=/tmp"},
+{ "server_tmp_dir", 0, STRING_K, &Server_tmp_dir_DYN,0,0,"=/var/tmp"},
/* no form feed separator between job files */
{ "sf", 0, FLAG_K, &No_FF_separator_DYN,0,0,"=1"},
/* suppress headers and/or banner page */
--- man/lpd.conf.n.orig 2008-02-28 16:38:00.000000000 +0100
+++ man/lpd.conf.n 2008-02-28 16:48:44.000000000 +0100
@@ -237,8 +237,11 @@ This is also used as the job class.
\fBdefault_remote_host\fR (default: "%H")
The default remote host to use.
.TP
-\fBdefault_tmp_dir\fR (default: /tmp)
+\fBdefault_tmp_dir\fR (default: /var/tmp)
Directory for temporary files.
+Must be on the same mounted filesystem as the spool directory
+so that rename(2) can atomically replace files in the
+spool directory with temporary files.
.TP
\fBdomain_name\fR (default: "")
This parameter is optional, and is appended to
@@ -561,8 +564,11 @@ accept the message on stdin, with \fIno\
The message will contain the \fBTo:\fR, \fBFrom:\fR,
\fBCc:\fR and \fBSubject:\fR headers.
.TP
-\fBserver_tmp_dir\fR (default: /tmp)
+\fBserver_tmp_dir\fR (default: /var/tmp)
Temporary dir for the server.
+Must be on the same mounted filesystem as the spool directory
+so that rename(2) can atomically replace files in the
+spool directory with temporary files.
.TP
\fBspool_dir_perms\fR (default: 042700)
Permissions of the spool directories.
--- man/printcap.n.orig 2008-02-28 16:37:06.000000000 +0100
+++ man/printcap.n 2008-02-28 16:37:47.000000000 +0100
@@ -269,7 +269,7 @@ default_priority R str A
default priority for printing jobs
default_remote_host A str localhost
default remote host for printing operations
-default_tmp_dir A str /tmp
+default_tmp_dir A str /var/tmp
default temporary directory
destinations D str NULL
names of printers that lpq/lprm should talk to
@@ -576,7 +576,7 @@ sendmail D str /usr/sbin/sendmail -oi -t
server A bool false printcap entry for server only
server_auth_command A str NULL
authentication command for server program
-server_tmp_dir D str /tmp
+server_tmp_dir D str /var/tmp
temporary directory for server to create files when there
is no spool directory.
server_user D str daemon server user name used in authentication operations