Improve a few error messages wrt if= filters on remote print queues.
This commit is contained in:
parent
9e36d98ddb
commit
0a860f59d0
@ -956,10 +956,20 @@ sendfile(pp, type, file, format)
|
|||||||
struct stat stb;
|
struct stat stb;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int sizerr, resp, closedpr;
|
int closedpr, resp, sizerr, statrc;
|
||||||
|
|
||||||
if (lstat(file, &stb) < 0 || (f = open(file, O_RDONLY)) < 0)
|
statrc = lstat(file, &stb);
|
||||||
|
if (statrc < 0) {
|
||||||
|
syslog(LOG_ERR, "%s: error from lstat(%s): %m",
|
||||||
|
pp->printer, file);
|
||||||
return(ERROR);
|
return(ERROR);
|
||||||
|
}
|
||||||
|
f = open(file, O_RDONLY);
|
||||||
|
if (f < 0) {
|
||||||
|
syslog(LOG_ERR, "%s: error from open(%s,O_RDONLY): %m",
|
||||||
|
pp->printer, file);
|
||||||
|
return(ERROR);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Check to see if data file is a symbolic link. If so, it should
|
* Check to see if data file is a symbolic link. If so, it should
|
||||||
* still point to the same file or someone is trying to print something
|
* still point to the same file or someone is trying to print something
|
||||||
@ -977,10 +987,11 @@ sendfile(pp, type, file, format)
|
|||||||
if (type == '\3') {
|
if (type == '\3') {
|
||||||
if (pp->filters[LPF_INPUT]) {
|
if (pp->filters[LPF_INPUT]) {
|
||||||
/*
|
/*
|
||||||
* We're sending something with an ifilter, we have to
|
* We're sending something with an ifilter. We have to
|
||||||
* run the ifilter and store the output as a
|
* run the ifilter and store the output as a temporary
|
||||||
* temporary file (tfile)... the protocol requires us
|
* spool file (tfile...), because the protocol requires
|
||||||
* to send the file size
|
* us to send the file size before we start sending any
|
||||||
|
* of the data.
|
||||||
*/
|
*/
|
||||||
char *av[15];
|
char *av[15];
|
||||||
int n;
|
int n;
|
||||||
@ -1054,8 +1065,12 @@ sendfile(pp, type, file, format)
|
|||||||
unlink(tfile);
|
unlink(tfile);
|
||||||
return(FILTERERR);
|
return(FILTERERR);
|
||||||
}
|
}
|
||||||
if (fstat(tfd, &stb) < 0) /* the size of tfile */
|
statrc = fstat(tfd, &stb); /* to find size of tfile */
|
||||||
|
if (statrc < 0) {
|
||||||
|
syslog(LOG_ERR, "%s: error processing 'if', fstat(%s): %m",
|
||||||
|
pp->printer, tfile);
|
||||||
return(ERROR);
|
return(ERROR);
|
||||||
|
}
|
||||||
f = tfd;
|
f = tfd;
|
||||||
lseek(f,0,SEEK_SET);
|
lseek(f,0,SEEK_SET);
|
||||||
} else if (ofilter) {
|
} else if (ofilter) {
|
||||||
@ -1083,7 +1098,10 @@ sendfile(pp, type, file, format)
|
|||||||
while ((i = wait(NULL)) > 0 && i != ofilter)
|
while ((i = wait(NULL)) > 0 && i != ofilter)
|
||||||
;
|
;
|
||||||
ofilter = 0;
|
ofilter = 0;
|
||||||
if (fstat(tfd, &stb) < 0) { /* the size of tfile */
|
statrc = fstat(tfd, &stb); /* to find size of tfile */
|
||||||
|
if (statrc < 0) {
|
||||||
|
syslog(LOG_ERR, "%s: error processing 'of', fstat(%s): %m",
|
||||||
|
pp->printer, tfile);
|
||||||
openpr(pp);
|
openpr(pp);
|
||||||
return(ERROR);
|
return(ERROR);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user