diff options
author | gad <gad@FreeBSD.org> | 2001-07-15 00:09:46 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2001-07-15 00:09:46 +0000 |
commit | 75f5203b04d78ac555161bc219da58cbfeffefbd (patch) | |
tree | 72f0a137b622cd6dc694bb199a12a08fd1b19169 /usr.sbin/lpr/lpd/recvjob.c | |
parent | c37f9bf14e59460fb949e607da4073e223e0972d (diff) | |
download | FreeBSD-src-75f5203b04d78ac555161bc219da58cbfeffefbd.zip FreeBSD-src-75f5203b04d78ac555161bc219da58cbfeffefbd.tar.gz |
Fix most of the warnings generated by compiling lpr with -Wnon-const-format,
often by just telling gcc that some internal routine is "__printflike"
(work done by Kris Kennaway <kris@FreeBSD.org>). Also fix the new warnings
which show up once gcc starts checking the "printf-like parameters" passed
to those routines.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/lpr/lpd/recvjob.c')
-rw-r--r-- | usr.sbin/lpr/lpd/recvjob.c | 16 |
1 files changed, 10 insertions, 6 deletions
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(); |