Changeset 133 in flair-src for trunk/lib/FlairCore/src/Socket_impl.cpp


Ignore:
Timestamp:
02/09/17 11:08:31 (5 years ago)
Author:
Sanahuja Guillaume
Message:

modif sterror

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/Socket_impl.cpp

    r93 r133  
    103103#endif
    104104  if (status != 0) {
    105     self->Err("rt_pipe_create error (%s)\n", strerror(-status));
     105                char errorMsg[256];
     106    self->Err("rt_pipe_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    106107  }
    107108
     
    148149  pthread_join(user_thread, NULL);
    149150  int status = rt_pipe_delete(&pipe);
    150   if (status != 0)
    151     self->Err("rt_pipe_delete error (%s)\n", strerror(-status));
    152 
     151  if (status != 0) {
     152                char errorMsg[256];
     153    self->Err("rt_pipe_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     154        }
    153155#endif
    154156  close(fd);
     
    158160  ssize_t written;
    159161  string to_send;
     162        char errorMsg[256];
    160163
    161164  if (broadcast == true) {
     
    170173
    171174  if (written < 0) {
    172     self->Err("rt_pipe_write error (%s)\n", strerror(-written));
     175    self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
    173176  } else if (written != (ssize_t)src_len) {
    174177    self->Err("rt_pipe_write error %i/%i\n", written, to_send.size());
     
    178181      sendto(fd, src, src_len, 0, (struct sockaddr *)&sock_in, sizeof(sock_in));
    179182  if(written==-1) {
    180     self->Err("sendto error (%s)\n",strerror(-errno));
     183                char errorMsg[256];
     184    self->Err("sendto error (%s)\n",strerror_r(errno, errorMsg, sizeof(errorMsg)));
    181185  } else if (written != (ssize_t)src_len) {
    182186    self->Err("sendto error %i/%i\n",written,src_len);
     
    195199
    196200  if (written < 0) {
    197     self->Err("rt_pipe_write error (%s)\n", strerror(-written));
     201                char errorMsg[256];
     202    self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
    198203  } else if (written != (ssize_t)message.size()) {
    199204    self->Err("rt_pipe_write error %i/%i\n", written, message.size());
     
    295300  while (pipe_fd < 0) {
    296301    pipe_fd = open(devname.c_str(), O_RDWR);
    297     if (pipe_fd < 0 && errno != ENOENT)
    298       caller->self->Err("open pipe_fd error (%s)\n", strerror(-errno));
     302    if (pipe_fd < 0 && errno != ENOENT) {
     303                        char errorMsg[256];
     304                        caller->self->Err("open pipe_fd error (%s)\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
     305                }
    299306    usleep(1000);
    300307  }
Note: See TracChangeset for help on using the changeset viewer.