[PATCH] Tell the user if they mistyped the confirmation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Attached is a small patch that explicitly tells the user if they
have mistyped the YES prompt and makes the word uppercase UPPERCASE.

(OK, I guess I'd best admit it took me longer to spot why it was
telling me command failed than it did to write this patch to tell
the next person.....)

Dave
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    | Running GNU/Linux on Alpha,68K| Happy  \ 
\ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
--- ../orig/ubuntu/src/cryptsetup.c	2009-06-06 14:58:44.000000000 +0100
+++ src/cryptsetup.c	2009-06-06 17:10:48.000000000 +0100
@@ -82,13 +82,16 @@
 	if(isatty(0) && !opt_batch_mode) {
 		char *answer=NULL;
 	        size_t size=0;
+		/* Note we don't capitalise the YES so people don't cut and paste and have to think. */
 		fprintf(stderr,"\nWARNING!\n========\n");
-		fprintf(stderr,"%s\n\nAre you sure? (Type uppercase yes): ",msg);
-		if(getline(&answer,&size,stdin) == -1)
-			return 0;
-		if(strcmp(answer,"YES\n") == 0)
-			r = 1;
-		free(answer);
+		fprintf(stderr,"%s\n\nAre you sure? (Type UPPERCASE yes): ",msg);
+		if(getline(&answer,&size,stdin) != -1) {
+			if(strcmp(answer,"YES\n") == 0)
+				r = 1;
+			free(answer);
+		}
+		if (!r)
+			set_error(_("Confirmation was wrong. You must type an UPPERCASE yes"));
 	} else
 		r = 1;
 	return r;

---------------------------------------------------------------------
dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux