Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2013 12:59:01 GMT
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/175404: patches for sbin/newfs_msdos
Message-ID:  <201301181259.r0ICx1dL084266@red.freebsd.org>
Resent-Message-ID: <201301181300.r0ID017V031802@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         175404
>Category:       bin
>Synopsis:       patches for sbin/newfs_msdos
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 18 13:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Christoph Mallon
>Release:        -
>Organization:
>Environment:
-
>Description:
A reminder requested by pfg@.

Two patches for newfs_msdos:
- The first simplifies some diagnostic messages from using {err,warn}x() to {err,warn}().
- The second makes some diagnostic messages more canocical by making the first letter lowercase.
(Sorry for concatenating them. The form only allows to attach one file.)
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

>From a178341a099b073226f1f6e95d427e0e73702ca7 Mon Sep 17 00:00:00 2001
From: Christoph Mallon <christoph.mallon@gmx.de>
Date: Fri, 18 Jan 2013 12:25:50 +0100
Subject: [PATCH 1/2] newfs_msdos: Use {err,warn}(...) instead of
 {err,warn}x(..., strerror(errno)).

---
 sbin/newfs_msdos/newfs_msdos.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index c2e9a35..83e65ed 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -832,18 +832,18 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
 	if (ioctl(fd, DIOCGDINFO, &dlp) == -1) {
 	    if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE,
 						  &dlp.d_secsize) == -1)
-		errx(1, "Cannot get sector size, %s", strerror(errno));
+		err(1, "Cannot get sector size");
 
 	    dlp.d_secperunit = ms / dlp.d_secsize;
 
 	    if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS,
 						  &dlp.d_nsectors) == -1) {
-		warnx("Cannot get number of sectors per track, %s", strerror(errno));
+		warn("Cannot get number of sectors per track");
 		dlp.d_nsectors = 63;
 	    }
 	    if (bpb->bpbHeads == 0 &&
 	        ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {
-		warnx("Cannot get number of heads, %s", strerror(errno));
+		warn("Cannot get number of heads");
 		if (dlp.d_secperunit <= 63*1*1024)
 		    dlp.d_ntracks = 1;
 		else if (dlp.d_secperunit <= 63*16*1024)
-- 
1.8.1

>From 39559da3baa7bb598d1d930c3fab5a0ff750a960 Mon Sep 17 00:00:00 2001
From: Christoph Mallon <christoph.mallon@gmx.de>
Date: Fri, 18 Jan 2013 12:53:51 +0100
Subject: [PATCH 2/2] newfs_msdos: Use lowercase letters for the first letter
 of diagnostic messages.

---
 sbin/newfs_msdos/newfs_msdos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index 83e65ed..fe1631a 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -808,7 +808,7 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
 	    struct stat st;
 
 	    if (fstat(fd, &st))
-		err(1, "Cannot get disk size");
+		err(1, "cannot get disk size");
 	    /* create a fake geometry for a file image */
 	    ms = st.st_size;
 	    dlp.d_secsize = 512;
@@ -832,18 +832,18 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
 	if (ioctl(fd, DIOCGDINFO, &dlp) == -1) {
 	    if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE,
 						  &dlp.d_secsize) == -1)
-		err(1, "Cannot get sector size");
+		err(1, "cannot get sector size");
 
 	    dlp.d_secperunit = ms / dlp.d_secsize;
 
 	    if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS,
 						  &dlp.d_nsectors) == -1) {
-		warn("Cannot get number of sectors per track");
+		warn("cannot get number of sectors per track");
 		dlp.d_nsectors = 63;
 	    }
 	    if (bpb->bpbHeads == 0 &&
 	        ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {
-		warn("Cannot get number of heads");
+		warn("cannot get number of heads");
 		if (dlp.d_secperunit <= 63*1*1024)
 		    dlp.d_ntracks = 1;
 		else if (dlp.d_secperunit <= 63*16*1024)
-- 
1.8.1



>Release-Note:
>Audit-Trail:
>Unformatted:



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