Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2001 22:30:01 -0700 (PDT)
From:      Mike Barcroft <mike@FreeBSD.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/28824: [patch] src/usr.sbin/burncd warning clean up
Message-ID:  <200107190530.f6J5U1C21261@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/28824; it has been noted by GNATS.

From: Mike Barcroft <mike@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: Bruce Evans <bde@zeta.org.au>
Subject: Re: bin/28824: [patch] src/usr.sbin/burncd warning clean up
Date: Thu, 19 Jul 2001 01:46:43 -0400

 This is an updated patch which addresses bde's concern regarding my
 previous patch.  The warning was masked on alpha by a typo ('%ul'
 instead of '%lu') in the fprintf(3) statement.
 
 ----------------------------------------------------------------------
 
 burncd.20010719.patch
  
 Index: burncd/Makefile
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/burncd/Makefile,v
 retrieving revision 1.4
 diff -u -r1.4 Makefile
 --- burncd/Makefile	2001/03/26 14:39:38	1.4
 +++ burncd/Makefile	2001/07/19 05:15:08
 @@ -1,6 +1,7 @@
  # $FreeBSD: src/usr.sbin/burncd/Makefile,v 1.4 2001/03/26 14:39:38 ru Exp $
  
  PROG=	burncd
 +WARNS?=	2
  MAN=	burncd.8
  
  .include <bsd.prog.mk>
 Index: burncd/burncd.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/burncd/burncd.c,v
 retrieving revision 1.13
 diff -u -r1.13 burncd.c
 --- burncd/burncd.c	2001/05/30 08:13:39	1.13
 +++ burncd/burncd.c	2001/07/19 05:15:09
 @@ -56,7 +56,7 @@
  {
  	int ch, arg, addr;
  	int eject=0, list=0, multi=0, preemp=0, speed=1, test_write=0;
 -	char *devname = "/dev/acd0c", *prog_name;
 +	const char *dev_name = "/dev/acd0c", *prog_name;
  	int block_size = 0;
  
  	prog_name = argv[0];
 @@ -67,7 +67,7 @@
  			break;
  
  		case 'f':
 -			devname = optarg;
 +			dev_name = optarg;
  			break;
  
  		case 'l':
 @@ -106,8 +106,8 @@
  	if (argc == 0)
  		usage(prog_name);
  
 -	if ((fd = open(devname, O_RDWR, 0)) < 0)
 -		err(EX_NOINPUT, "open(%s)", devname);
 +	if ((fd = open(dev_name, O_RDWR, 0)) < 0)
 +		err(EX_NOINPUT, "open(%s)", dev_name);
  
  	if (ioctl(fd, CDRIOCWRITESPEED, &speed) < 0) 
         		err(EX_IOERR, "ioctl(CDRIOCWRITESPEED)");
 @@ -134,8 +134,8 @@
  				err(EX_IOERR, "ioctl(CDIOREADTOCENTRY)");
  			if (ioctl(fd, CDRIOCNEXTWRITEABLEADDR, &addr) < 0) 
  				err(EX_IOERR, "ioctl(CDRIOCNEXTWRITEABLEADDR)");
 -			fprintf(stderr, "%d, %d\n", 
 -				ntohl(entry.entry.addr.lba), addr);
 +			fprintf(stderr, "%lu, %d\n", 
 +				(u_long)ntohl(entry.entry.addr.lba), addr);
  
  			break;
  		}
 @@ -207,7 +207,7 @@
  			while (fgets(file_buf, sizeof(file_buf), fp) != NULL) {
  				if (*file_buf == '#' || *file_buf == '\n')
  					continue;
 -				if (eol = strchr(file_buf, '\n'))
 +				if ((eol = strchr(file_buf, '\n')) != NULL)
  					*eol = NULL;
  				write_file(file_buf, block_size);
  			}
 @@ -233,7 +233,7 @@
  }
  
  void
 -cleanup(int dummy)
 +cleanup(int dummy __unused)
  {
  	if (ioctl(fd, CDRIOCSETBLOCKSIZE, &saved_block_size) < 0) 
  		err(EX_IOERR, "ioctl(CDRIOCSETBLOCKSIZE)");
 @@ -252,7 +252,7 @@
  {
  	int addr, count, file, filesize, size;
  	char buf[2352*BLOCKS];
 -	struct stat stat;
 +	struct stat filestat;
  	static int cdopen, done_stdin, tot_size = 0;
  
  	if (!strcmp(name, "-")) {
 @@ -278,9 +278,9 @@
  	if (ioctl(fd, CDRIOCNEXTWRITEABLEADDR, &addr) < 0) 
         		err(EX_IOERR, "ioctl(CDRIOCNEXTWRITEABLEADDR)");
  
 -	if (fstat(file, &stat) < 0)
 +	if (fstat(file, &filestat) < 0)
  		err(EX_IOERR, "fstat(%s)", name);
 -	filesize = stat.st_size / 1024;
 +	filesize = filestat.st_size / 1024;
  
  	if (!quiet) {
  		fprintf(stderr, "next writeable LBA %d\n", addr);

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107190530.f6J5U1C21261>