@@ -282,7 +282,7 @@ static void send_to_all(const char *fmt, ...)
282282
283283 result = WriteFile (conn -> fd , buf , buflen , & bytesWritten , NULL );
284284 if ( result == 0 ) {
285- upsdebugx (2 , "write failed on handle %p, disconnecting" , conn -> fd );
285+ upsdebugx (2 , "%s: write failed on handle %p, disconnecting" , __func__ , conn -> fd );
286286 sock_disconnect (conn );
287287 continue ;
288288 }
@@ -301,7 +301,7 @@ static void send_to_all(const char *fmt, ...)
301301 "handle %p failed (ret=%" PRIiSIZE "), disconnecting: %s" ,
302302 __func__ , buflen , conn -> fd , ret , strerror (errno ));
303303#endif
304- upsdebugx (6 , "failed write: %s" , buf );
304+ upsdebugx (6 , "%s: failed write: %s" , __func__ , buf );
305305
306306 sock_disconnect (conn );
307307
@@ -427,7 +427,7 @@ static int send_to_one(conn_t *conn, const char *fmt, ...)
427427 "handle %p failed (ret=%" PRIiSIZE "), disconnecting: %s" ,
428428 __func__ , buflen , conn -> fd , ret , strerror (errno ));
429429#endif
430- upsdebugx (6 , "failed write: %s" , buf );
430+ upsdebugx (6 , "%s: failed write: %s" , __func__ , buf );
431431 sock_disconnect (conn );
432432
433433 /* TOTHINK: Maybe fallback elsewhere in other cases? */
@@ -475,7 +475,7 @@ static void sock_connect(TYPE_FD sock)
475475 fd = accept (sock , (struct sockaddr * ) & sa , & salen );
476476
477477 if (INVALID_FD (fd )) {
478- upslog_with_errno (LOG_ERR , "accept on unix fd failed" );
478+ upslog_with_errno (LOG_ERR , "%s: accept on unix fd failed" , __func__ );
479479 return ;
480480 }
481481
@@ -491,15 +491,15 @@ static void sock_connect(TYPE_FD sock)
491491 ret = fcntl (fd , F_GETFL , 0 );
492492
493493 if (ret < 0 ) {
494- upslog_with_errno (LOG_ERR , "fcntl get on unix fd failed" );
494+ upslog_with_errno (LOG_ERR , "%s: fcntl get on unix fd failed" , __func__ );
495495 close (fd );
496496 return ;
497497 }
498498
499499 ret = fcntl (fd , F_SETFL , ret | O_NDELAY );
500500
501501 if (ret < 0 ) {
502- upslog_with_errno (LOG_ERR , "fcntl set O_NDELAY on unix fd failed" );
502+ upslog_with_errno (LOG_ERR , "%s: fcntl set O_NDELAY on unix fd failed" , __func__ );
503503 close (fd );
504504 return ;
505505 }
@@ -581,9 +581,9 @@ static void sock_connect(TYPE_FD sock)
581581 connhead = conn ;
582582
583583#ifndef WIN32
584- upsdebugx (3 , "new connection on fd %d" , fd );
584+ upsdebugx (3 , "%s: new connection on fd %d" , __func__ , fd );
585585#else
586- upsdebugx (3 , "new connection on handle %p" , sock );
586+ upsdebugx (3 , "%s: new connection on handle %p" , __func__ , sock );
587587#endif
588588
589589}
@@ -685,8 +685,8 @@ static int sock_arg(conn_t *conn, size_t numarg, char **arg)
685685 char * sockfn = pipename ; /* Just for the report below; not a global var in WIN32 builds */
686686#endif
687687
688- upsdebugx (6 , "Driver on %s is now handling %s with %" PRIuSIZE " args" ,
689- sockfn , numarg ? arg [0 ] : "<skipped: no command>" , numarg );
688+ upsdebugx (6 , "%s: Driver on %s is now handling %s with %" PRIuSIZE " args" ,
689+ __func__ , sockfn , numarg ? arg [0 ] : "<skipped: no command>" , numarg );
690690
691691 if (numarg < 1 ) {
692692 return 0 ;
@@ -1037,9 +1037,9 @@ char * dstate_init(const char *prog, const char *devname)
10371037 sockfd = sock_open (sockname );
10381038
10391039#ifndef WIN32
1040- upsdebugx (2 , "dstate_init : sock %s open on fd %d" , sockname , sockfd );
1040+ upsdebugx (2 , "%s : sock %s open on fd %d" , __func__ , sockname , sockfd );
10411041#else
1042- upsdebugx (2 , "dstate_init : sock %s open on handle %p" , sockname , sockfd );
1042+ upsdebugx (2 , "%s : sock %s open on handle %p" , __func__ , sockname , sockfd );
10431043#endif
10441044
10451045 /* NOTE: Caller must free this string */
@@ -1112,7 +1112,7 @@ int dstate_poll_fds(struct timeval timeout, TYPE_FD arg_extrafd)
11121112 break ;
11131113
11141114 default :
1115- upslog_with_errno (LOG_ERR , "select unix sockets failed" );
1115+ upslog_with_errno (LOG_ERR , "%s: select unix sockets failed" , __func__ );
11161116 }
11171117
11181118 return overrun ;
@@ -1189,7 +1189,7 @@ int dstate_poll_fds(struct timeval timeout, TYPE_FD arg_extrafd)
11891189 }
11901190
11911191 if (ret == WAIT_FAILED ) {
1192- upslog_with_errno (LOG_ERR , "waitfor failed" );
1192+ upslog_with_errno (LOG_ERR , "%s: waitfor failed" , __func__ );
11931193 return overrun ;
11941194 }
11951195
@@ -1390,7 +1390,7 @@ void dstate_setaux(const char *var, long aux)
13901390 sttmp = state_tree_find (dtree_root , var );
13911391
13921392 if (!sttmp ) {
1393- upslogx (LOG_ERR , "dstate_setaux : base variable (%s) does not exist" , var );
1393+ upslogx (LOG_ERR , "%s : base variable (%s) does not exist" , __func__ , var );
13941394 return ;
13951395 }
13961396
0 commit comments