diff options
Diffstat (limited to 'usr.sbin/lpr/lpd')
-rw-r--r-- | usr.sbin/lpr/lpd/lpd.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 5 | ||||
-rw-r--r-- | usr.sbin/lpr/lpd/recvjob.c | 16 |
3 files changed, 15 insertions, 10 deletions
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c index 866ab43..b48cf25 100644 --- a/usr.sbin/lpr/lpd/lpd.c +++ b/usr.sbin/lpr/lpd/lpd.c @@ -115,7 +115,7 @@ static void startup(void); static void chkhost(struct sockaddr *_f, int _ch_opts); static int ckqueue(struct printer *_pp); static void fhosterr(int _dosys, const char *_sysmsg, const char *_usermsg, - ...); + ...) __printf0like(3, 4); static int *socksetup(int _af, int _debuglvl); static void usage(void); @@ -512,7 +512,7 @@ doit(void) } status = getprintcap(printer, pp); if (status < 0) - fatal(pp, pcaperr(status)); + fatal(pp, "%s", pcaperr(status)); displayq(pp, cbuf[0] == CMD_SHOWQ_LONG); exit(0); case CMD_RMJOB: /* remove a job from the queue */ diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index d2705c3..e2ce3ea 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -133,7 +133,8 @@ static void opentty(const struct printer *_pp); static void openrem(const struct printer *pp); static int print(struct printer *_pp, int _format, char *_file); static int printit(struct printer *_pp, char *_file); -static void pstatus(const struct printer *_pp, const char *_msg, ...); +static void pstatus(const struct printer *_pp, const char *_msg, ...) + __printflike(2, 3); static char response(const struct printer *_pp); static void scan_out(struct printer *_pp, int _scfd, char *_scsp, int _dlm); @@ -1605,7 +1606,7 @@ opennet(const struct printer *pp) } sleep(i); } - pstatus(pp, "sending to %s port %d", ep, port); + pstatus(pp, "sending to %s port %lu", ep, port); } /* diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c index 99e38de..c610271 100644 --- a/usr.sbin/lpr/lpd/recvjob.c +++ b/usr.sbin/lpr/lpd/recvjob.c @@ -58,6 +58,7 @@ static const char rcsid[] = #include <signal.h> #include <fcntl.h> #include <dirent.h> +#include <errno.h> #include <syslog.h> #include <stdio.h> #include <stdlib.h> @@ -75,7 +76,7 @@ static const char *sp = ""; static char tfname[NAME_MAX]; /* tmp copy of cf before linking */ static int chksize(int _size); -static void frecverr(const char *_msg, ...); +static void frecverr(const char *_msg, ...) __printf0like(1, 2); static int noresponse(void); static void rcleanup(int _signo); static int read_number(const char *_fn); @@ -115,7 +116,8 @@ recvjob(const char *printer) } if (chdir(pp->spool_dir) < 0) - frecverr("%s: %s: %m", pp->printer, pp->spool_dir); + frecverr("%s: chdir(%s): %s", pp->printer, pp->spool_dir, + strerror(errno)); if (stat(pp->lock_file, &stb) == 0) { if (stb.st_mode & 010) { /* queue is disabled */ @@ -123,7 +125,8 @@ recvjob(const char *printer) exit(1); } } else if (stat(pp->spool_dir, &stb) < 0) - frecverr("%s: %s: %m", pp->printer, pp->spool_dir); + frecverr("%s: stat(%s): %s", pp->printer, pp->spool_dir, + strerror(errno)); minfree = 2 * read_number("minfree"); /* scale KB to 512 blocks */ signal(SIGTERM, rcleanup); signal(SIGPIPE, rcleanup); @@ -204,7 +207,8 @@ readjob(struct printer *pp) continue; } if (link(tfname, cp) < 0) - frecverr("%s: %m", tfname); + frecverr("%s: link(%s): %s", pp->printer, + tfname, strerror(errno)); (void) unlink(tfname); tfname[0] = '\0'; cfcnt++; @@ -254,8 +258,8 @@ readfile(struct printer *pp, char *file, int size) fd = open(file, O_CREAT|O_EXCL|O_WRONLY, FILMOD); if (fd < 0) { - frecverr("%s: readfile: error on open(%s): %m", - pp->printer, file); + frecverr("%s: readfile: error on open(%s): %s", + pp->printer, file, strerror(errno)); /*NOTREACHED*/ } ack(); |