bin/178422: [PATCH] don't be picky about case with yes/no prompt in growfs(8)

Garrett Cooper yaneurabeya at gmail.com
Wed May 8 16:00:00 UTC 2013


>Number:         178422
>Category:       bin
>Synopsis:       [PATCH] don't be picky about case with yes/no prompt in growfs(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 08 16:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD fuji-current.local 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r+6a3d3f6-dirty: Sat Apr 27 16:03:39 PDT 2013     root at fuji-current.local:/usr/obj/usr/src/sys/FUJI  i386
>Description:
The attached patch changes the prompt check from strcmp to strcasecmp so I dont have to type in "Yes" exactly in order to use growfs interactively.
>How-To-Repeat:
md=$(mdconfig -a -t malloc -s 100m)
newfs -s 50m /dev/$md
sh -c 'newfs -s $(( 50 * 1024 * 1024  / 512 )) /dev/$md'
growfs /dev/$md
>Fix:


Patch attached with submission follows:

>From f30baf745ad8704685fd32701c7bd492129c05da Mon Sep 17 00:00:00 2001
From: Garrett Cooper <yanegomi at gmail.com>
Date: Wed, 8 May 2013 08:41:08 -0700
Subject: [PATCH] Don't be picky with case for yes/no prompt

Signed-off-by: Garrett Cooper <yanegomi at gmail.com>
---
 sbin/growfs/growfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index fe49efb..e011a1b 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1544,7 +1544,7 @@ main(int argc, char **argv)
 		printf(" from %s to %s? [Yes/No] ", oldsizebuf, newsizebuf);
 		fflush(stdout);
 		fgets(reply, (int)sizeof(reply), stdin);
-		if (strcmp(reply, "Yes\n")){
+		if (strcasecmp(reply, "yes\n") != 0) {
 			printf("\nNothing done\n");
 			exit (0);
 		}
-- 
1.8.2



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


More information about the freebsd-bugs mailing list