Browse Source

[libc] Use only generic errortab entries to match generic errors

tags/v1.0.0-rc1
Michael Brown 15 years ago
parent
commit
76d5e493d1
1 changed files with 4 additions and 5 deletions
  1. 4
    5
      src/hci/strerror.c

+ 4
- 5
src/hci/strerror.c View File

24
  * Find error description
24
  * Find error description
25
  *
25
  *
26
  * @v errno		Error number
26
  * @v errno		Error number
27
- * @v mask		Mask of bits that we care about
28
  * @ret errortab	Error description, or NULL
27
  * @ret errortab	Error description, or NULL
29
  */
28
  */
30
-static struct errortab * find_error ( int errno, int mask ) {
29
+static struct errortab * find_error ( int errno ) {
31
 	struct errortab *errortab;
30
 	struct errortab *errortab;
32
 
31
 
33
 	for_each_table_entry ( errortab, ERRORTAB ) {
32
 	for_each_table_entry ( errortab, ERRORTAB ) {
34
-		if ( ( ( errortab->errno ^ errno ) & mask ) == 0 )
33
+		if ( errortab->errno == errno )
35
 			return errortab;
34
 			return errortab;
36
 	}
35
 	}
37
 
36
 
50
 	struct errortab *errortab;
49
 	struct errortab *errortab;
51
 
50
 
52
 	/* First, look for an exact match */
51
 	/* First, look for an exact match */
53
-	if ( ( errortab = find_error ( errno, 0x7fffffff ) ) != NULL )
52
+	if ( ( errortab = find_error ( errno ) ) != NULL )
54
 		return errortab;
53
 		return errortab;
55
 
54
 
56
 	/* Second, try masking off the gPXE-specific bit and seeing if
55
 	/* Second, try masking off the gPXE-specific bit and seeing if
57
 	 * we have an entry for the generic POSIX error message.
56
 	 * we have an entry for the generic POSIX error message.
58
 	 */
57
 	 */
59
-	if ( ( errortab = find_error ( errno, 0x4f0000ff ) ) != NULL )
58
+	if ( ( errortab = find_error ( errno & 0x7f0000ff ) ) != NULL )
60
 		return errortab;
59
 		return errortab;
61
 
60
 
62
 	return NULL;
61
 	return NULL;

Loading…
Cancel
Save