Procházet zdrojové kódy

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

tags/v1.0.0-rc1
Michael Brown před 14 roky
rodič
revize
76d5e493d1
1 změnil soubory, kde provedl 4 přidání a 5 odebrání
  1. 4
    5
      src/hci/strerror.c

+ 4
- 5
src/hci/strerror.c Zobrazit soubor

@@ -24,14 +24,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
24 24
  * Find error description
25 25
  *
26 26
  * @v errno		Error number
27
- * @v mask		Mask of bits that we care about
28 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 30
 	struct errortab *errortab;
32 31
 
33 32
 	for_each_table_entry ( errortab, ERRORTAB ) {
34
-		if ( ( ( errortab->errno ^ errno ) & mask ) == 0 )
33
+		if ( errortab->errno == errno )
35 34
 			return errortab;
36 35
 	}
37 36
 
@@ -50,13 +49,13 @@ static struct errortab * find_closest_error ( int errno ) {
50 49
 	struct errortab *errortab;
51 50
 
52 51
 	/* First, look for an exact match */
53
-	if ( ( errortab = find_error ( errno, 0x7fffffff ) ) != NULL )
52
+	if ( ( errortab = find_error ( errno ) ) != NULL )
54 53
 		return errortab;
55 54
 
56 55
 	/* Second, try masking off the gPXE-specific bit and seeing if
57 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 59
 		return errortab;
61 60
 
62 61
 	return NULL;

Načítá se…
Zrušit
Uložit