duid capital letters

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stefan Sperling
Date: Wednesday, December 29, 2010 - 5:02 am

Allow capital letters in disk_map() and isduid() since disklabel.c
also allows them as of this revision:
----------------------------
revision 1.166
date: 2010/06/30 23:44:06;  author: halex;  state: Exp;  lines: +3 -1
allow uppercase A-F in the uid input

ok krw@ jsing@
=============================================================================

Together with my swapctl diff, this fixes swapctl -A for duids with
capital letters.

ok?

Index: sys/kern/subr_disk.c
===================================================================
RCS file: /cvs/src/sys/kern/subr_disk.c,v
retrieving revision 1.114
diff -u -p -r1.114 subr_disk.c
--- sys/kern/subr_disk.c	24 Nov 2010 15:31:34 -0000	1.114
+++ sys/kern/subr_disk.c	29 Dec 2010 11:41:42 -0000
@@ -1389,6 +1389,8 @@ disk_map(char *path, char *mappath, int 
 			c -= '0';
 		else if (c >= 'a' && c <= 'f')
 			c -= ('a' - 10);
+		else if (c >= 'A' && c <= 'F')
+			c -= ('A' - 10);
                 else
 			return -1;
 
Index: lib/libutil/duid.c
===================================================================
RCS file: /cvs/src/lib/libutil/duid.c,v
retrieving revision 1.1
diff -u -p -r1.1 duid.c
--- lib/libutil/duid.c	15 Nov 2010 15:07:40 -0000	1.1
+++ lib/libutil/duid.c	29 Dec 2010 11:24:20 -0000
@@ -32,7 +32,8 @@ isduid(const char *duid, int dflags)
 	/* Check UID. */
 	for (i = 0; i < 16; i++) {
 		c = duid[i];
-		if ((c < '0' || c > '9') && (c < 'a' || c > 'f'))
+		if ((c < '0' || c > '9') && (c < 'a' || c > 'f') &&
+		    (c < 'A' || c > 'F'))
 			return 0;
 	}
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
duid capital letters, Stefan Sperling, (Wed Dec 29, 5:02 am)