summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/lpr
diff options
context:
space:
mode:
authoredwin <edwin@FreeBSD.org>2010-10-21 06:52:14 +0000
committeredwin <edwin@FreeBSD.org>2010-10-21 06:52:14 +0000
commitbb83dbde82d27c4b98ed89539ef5fc4e7644626f (patch)
treeed5151b8d015c9157c3726080cd7e3ee208fd07f /usr.sbin/lpr/lpr
parent987ad790da2bea176e0fb3e7e56254091c6c6cc6 (diff)
downloadFreeBSD-src-bb83dbde82d27c4b98ed89539ef5fc4e7644626f.zip
FreeBSD-src-bb83dbde82d27c4b98ed89539ef5fc4e7644626f.tar.gz
Fix printing of files located on ZFS filesystem with an st_dev or
st_ino larger than 2**31. From the PR: Printing from a ZFS filesystem using 'lp' fails and returns an email reporting "Your printer job was not printed because it was not linked to the original file". In order to protect against files being switched when files are printed using 'lp' or 'lpr -s', the st_dev and st_ino values for the original file are saved by lpr and verified by lpd before the file is printed. Unfortunately, lpr prints both values using '%d' (although both fields are unsigned) and lpd(8) assumes a string of decimal digits. ZFS (at least) generates st_dev values greater than 2^31-1, resulting in negative values being printed - which lpd cannot parse, leading it to report that the file has been switched. A similar problem would occur with large inode numbers. How-To-Repeat: Find a file with either st_dev or st_ino greater than 2^31-1 (stat(1) will report both numbers) and print it with 'lpq -s'. This should generate an email reporting that the file could not be printed because it was not linked to the original file PR: bin/151567 Submitted by: Peter Jeremy <Peter.Jeremy@alcatel-lucent.com> MFC after: 1 week
Diffstat (limited to 'usr.sbin/lpr/lpr')
-rw-r--r--usr.sbin/lpr/lpr/lpr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c
index 98e9cea..c2f88a0 100644
--- a/usr.sbin/lpr/lpr/lpr.c
+++ b/usr.sbin/lpr/lpr/lpr.c
@@ -386,7 +386,7 @@ main(int argc, char *argv[])
continue; /* file unreasonable */
if (sflag && (cp = linked(arg)) != NULL) {
- (void) snprintf(buf, sizeof(buf), "%d %d", statb.st_dev,
+ (void) snprintf(buf, sizeof(buf), "%u %u", statb.st_dev,
statb.st_ino);
card('S', buf);
if (format == 'p')
OpenPOWER on IntegriCloud