47 #define CVT_BUF_MAX 1023 53 FILE *
file = fopen(
"/etc/os-release",
"r");
59 url = (
char *) malloc(url_len *
sizeof(
char));
60 strcpy(url,
"https://bugs.openanolis.cn");
65 while ((getline(&
line, &len,
file)) != -1) {
66 if (strstr(
line,
"BUG_REPORT_URL") != NULL) {
67 char * start = strchr(
line,
'=');
68 char * rquotes = strrchr(
line,
'"');
70 if (rquotes != NULL) {
72 strncpy(url, start+2, url_len);
74 strncpy(url, start+1, url_len);
76 url[url_len-1] =
'\0';
98 vsnprintf (mbuf,
sizeof mbuf, fbuf, list);
102 syslog (LOG_ERR,
"%s", mbuf);
112 log_error (
"This version of ISC DHCP is based on the release available");
113 log_error (
"on ftp.isc.org. Features have been added and other changes");
114 log_error (
"have been made to the base software release in order to make");
115 log_error (
"it work better with this distribution.");
117 log_error (
"Please report issues with this software via: ");
138 va_start (list, fmt);
139 vsnprintf (mbuf,
sizeof mbuf, fbuf, list);
143 syslog (LOG_ERR,
"%s", mbuf);
165 va_start (list, fmt);
166 vsnprintf (mbuf,
sizeof mbuf, fbuf, list);
170 syslog (LOG_INFO,
"%s", mbuf);
192 va_start (list, fmt);
193 vsnprintf (mbuf,
sizeof mbuf, fbuf, list);
197 syslog (LOG_DEBUG,
"%s", mbuf);
214 const char *s = ibuf;
224 m = strerror (errno);
229 m =
"<unknown error>";
258 extern char *sys_errlist [];
260 static char errbuf [128];
262 if (err < 0 || err >= sys_nerr) {
263 sprintf (errbuf,
"Error %d", err);
266 return sys_errlist [err];
273 int err = WSAGetLastError ();
278 return "Permission denied";
280 return "Address already in use";
281 case WSAEADDRNOTAVAIL:
282 return "Cannot assign requested address";
283 case WSAEAFNOSUPPORT:
284 return "Address family not supported by protocol family";
286 return "Operation already in progress";
287 case WSAECONNABORTED:
288 return "Software caused connection abort";
289 case WSAECONNREFUSED:
290 return "Connection refused";
292 return "Connection reset by peer";
293 case WSAEDESTADDRREQ:
294 return "Destination address required";
296 return "Bad address";
298 return "Host is down";
299 case WSAEHOSTUNREACH:
300 return "No route to host";
302 return "Operation now in progress";
304 return "Interrupted function call";
306 return "Invalid argument";
308 return "Socket is already connected";
310 return "Too many open files";
312 return "Message too long";
314 return "Network is down";
316 return "Network dropped connection on reset";
318 return "Network is unreachable";
320 return "No buffer space available";
322 return "Bad protocol option";
324 return "Socket is not connected";
326 return "Socket operation on non-socket";
328 return "Operation not supported";
329 case WSAEPFNOSUPPORT:
330 return "Protocol family not supported";
332 return "Too many processes";
333 case WSAEPROTONOSUPPORT:
334 return "Protocol not supported";
336 return "Protocol wrong type for socket";
338 return "Cannot send after socket shutdown";
339 case WSAESOCKTNOSUPPORT:
340 return "Socket type not supported";
342 return "Connection timed out";
344 return "Resource temporarily unavailable";
345 case WSAHOST_NOT_FOUND:
346 return "Host not found";
348 case WSA_INVALID_HANDLE:
349 return "Specified event object handle is invalid";
350 case WSA_INVALID_PARAMETER:
351 return "One or more parameters are invalid";
352 case WSAINVALIDPROCTABLE:
353 return "Invalid procedure table from service provider";
354 case WSAINVALIDPROVIDER:
355 return "Invalid service provider version number";
357 return "Overlapped operations will complete later";
358 case WSA_IO_INCOMPLETE:
359 return "Overlapped I/O event object not in signaled state";
360 case WSA_NOT_ENOUGH_MEMORY:
361 return "Insufficient memory available";
363 case WSANOTINITIALISED:
364 return "Successful WSAStartup not yet performer";
366 return "Valid name, no data record of requested type";
368 return "This is a non-recoverable error";
370 case WSAPROVIDERFAILEDINIT:
371 return "Unable to initialize a service provider";
372 case WSASYSCALLFAILURE:
373 return "System call failure";
376 return "Network subsystem is unavailable";
378 return "Non-authoritative host not found";
379 case WSAVERNOTSUPPORTED:
380 return "WINSOCK.DLL version out of range";
382 return "Graceful shutdown in progress";
384 case WSA_OPERATION_ABORTED:
385 return "Overlapped operation aborted";
388 return "Unknown WinSock error";
int log_debug(const char *fmt,...)
char * bug_report_url(void)
int log_error(const char *fmt,...)
void log_fatal(const char *fmt,...)
void(* log_cleanup)(void)
void do_percentm(char *obuf, const char *ibuf)
int log_info(const char *fmt,...)