소스 검색

Added messages for some of the most common errors

tags/v0.9.3
Michael Brown 18 년 전
부모
커밋
fc7dcc201b
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11
    0
      src/hci/strerror.c

+ 11
- 0
src/hci/strerror.c 파일 보기

@@ -38,6 +38,10 @@ const char * strerror ( int errno ) {
38 38
 	static char *generic_message = "Error 0x0000";
39 39
 	struct errortab *errortab;
40 40
 
41
+	/* Allow for strerror(rc) as well as strerror(errno) */
42
+	if ( errno < 0 )
43
+		errno = -errno;
44
+
41 45
 	for ( errortab = errortab_start ; errortab < errortab_end ;
42 46
 	      errortab++ ) {
43 47
 		if ( errortab->errno == errno )
@@ -47,3 +51,10 @@ const char * strerror ( int errno ) {
47 51
 	sprintf ( generic_message + 8, "%hx", errno );
48 52
 	return generic_message;
49 53
 }
54
+
55
+/** The most common errors */
56
+struct errortab common_errortab[] __errortab = {
57
+	{ ENOMEM, "Out of memory" },
58
+	{ EINVAL, "Invalid argument" },
59
+	{ ENOSPC, "No space left on device" },
60
+};

Loading…
취소
저장