Achieved minimum strerror thread safety (strerror_r is burned by Unix and GNU)

This commit is contained in:
Thomas Schmitt 2006-09-25 14:43:41 +00:00
parent 12ad9100ff
commit bbcf7c269c
2 changed files with 7 additions and 5 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.09.25.141035" #define Cdrskin_timestamP "2006.09.25.144506"

View File

@ -270,7 +270,7 @@ int libdax_msgs_submit(struct libdax_msgs *m, int driveno, int error_code,
int os_errno, int flag) int os_errno, int flag)
{ {
int ret; int ret;
char *textpt,*sev_name,sev_text[81],error_buf[1024]; char *textpt,*sev_name,sev_text[81];
struct libdax_msgs_item *item= NULL; struct libdax_msgs_item *item= NULL;
if(severity >= m->print_severity) { if(severity >= m->print_severity) {
@ -285,10 +285,12 @@ int libdax_msgs_submit(struct libdax_msgs *m, int driveno, int error_code,
fprintf(stderr,"%s%s%s\n",m->print_id,sev_text,textpt); fprintf(stderr,"%s%s%s\n",m->print_id,sev_text,textpt);
if(os_errno!=0) { if(os_errno!=0) {
error_buf[0]= 0; ret= libdax_msgs_lock(m,0);
strerror_r(os_errno, error_buf,1024); if(ret<=0)
return(-1);
fprintf(stderr,"%s( Most recent system error: %d '%s' )\n", fprintf(stderr,"%s( Most recent system error: %d '%s' )\n",
m->print_id,os_errno,error_buf); m->print_id,os_errno,strerror(os_errno));
libdax_msgs_unlock(m,0);
} }
} }