Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jun 2000 09:42:13 -0700
From:      Ken Marx <kmarx@bigshed.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   lpr -s -r (again)
Message-ID:  <3950F065.74366D5F@bigshed.com>

next in thread | raw e-mail | index | archive | help
Hi,

More on this lpr -r -s thing...

I'd like to suggest a change to the lpd code, and get some feedback.

Again, there's this thing with lpr where specifying both -s and -r together
results in the '-r' not being honored. That is, the file is not
removed after printing.

I looked more at the lpr and lpd code and found that the behavior is due
to lpd refusing to unlink the file if it's pathname begins with '/'.
This happens to be the case when -s is used, since lpr has to tell
lpd the full pathname to delete. (Note: when -s is *not* used, lpr
does the delete of the file, not lpd.)

I'm not sure why lpd has this 'safety' code in there. I can certainly
make the -r -s combination work correctly by making the following change in
lpd's printjob.c:

--- printjob.c  Wed Jun 21 08:55:52 2000
***************
*** 499,506 ****
                        continue;
  
                case 'U':
-                       if (strchr(line+1, '/'))
-                               continue;
                        (void) unlink(line+1);
                }
        /*
--- 499,504 ----

That is, delete the check for '/', and allow the unlink in all cases.

Is there some reason not to make this change permanent?
Note that lpr has code that will protect files from being deleted
if permissions would disallow it.

I tested this for local printing, but not remote.

Any thoughts appreciated.

Thanks,
k.
-- 
Ken Marx, kmarx@bigshed.com
Revise the expectations surrounding the problem space!!
		- http://cgi.bigshed.com/~kmarx/cgi-bin/speak.cgi


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3950F065.74366D5F>