Przeglądaj źródła

[libc] Ensure that error numbers from EUNIQ() have the correct type

Error numbers are signed ints.  EUNIQ() should not allow implicit type
promotion based on the supplied error diambiguator, because this
causes problems with statements such as

  rc = ( condition ? -EUNIQ ( EBASE, disambiguator ) : -EBASE );

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 15 lat temu
rodzic
commit
2a92697bda
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1
    1
      src/include/errno.h

+ 1
- 1
src/include/errno.h Wyświetl plik

201
  */
201
  */
202
 #define EUNIQ( errno, uniq, ... ) ( {					\
202
 #define EUNIQ( errno, uniq, ... ) ( {					\
203
 	euniq_discard ( 0, ##__VA_ARGS__);				\
203
 	euniq_discard ( 0, ##__VA_ARGS__);				\
204
-	( (errno) | ( (uniq) << 8 ) ); } )
204
+	( ( int ) ( (errno) | ( (uniq) << 8 ) ) ); } )
205
 static inline void euniq_discard ( int dummy __unused, ... ) {}
205
 static inline void euniq_discard ( int dummy __unused, ... ) {}
206
 
206
 
207
 /**
207
 /**

Ładowanie…
Anuluj
Zapisz