From 87ad3f24075233ebadc8cbf3432620b20d81465a Mon Sep 17 00:00:00 2001 From: pascal Date: Wed, 21 May 2014 18:38:42 +0000 Subject: [PATCH] stat(2) on the spool file needs privileges. Fixes file size reported by lpq -l. ok millert@ --- usr.sbin/lpr/common_source/displayq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c index 4db659cc62c..5f3301e785b 100644 --- a/usr.sbin/lpr/common_source/displayq.c +++ b/usr.sbin/lpr/common_source/displayq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: displayq.c,v 1.34 2013/11/24 21:32:32 deraadt Exp $ */ +/* $OpenBSD: displayq.c,v 1.35 2014/05/21 18:38:42 pascal Exp $ */ /* $NetBSD: displayq.c,v 1.21 2001/08/30 00:51:50 itojun Exp $ */ /* @@ -482,13 +482,17 @@ void ldump(char *nfile, char *file, int copies) { struct stat lbuf; + int ret; putchar('\t'); if (copies > 1) printf("%-2d copies of %-19s", copies, nfile); else printf("%-32s", nfile); - if (*file && !stat(file, &lbuf)) + PRIV_START; + ret = stat(file, &lbuf); + PRIV_END; + if (*file && !ret) printf(" %lld bytes", (long long)lbuf.st_size); else printf(" ??? bytes"); -- 2.20.1