@@ -340,7 +340,7 @@ qb_ipc_auth_creds(struct ipc_auth_data *data)
340340 res = - errno ;
341341 }
342342 }
343- #elif HAVE_GETPEEREID
343+ #elif defined( HAVE_GETPEEREID )
344344 /*
345345 * Usually MacOSX systems
346346 */
@@ -356,7 +356,7 @@ qb_ipc_auth_creds(struct ipc_auth_data *data)
356356 }
357357 }
358358
359- #elif SO_PASSCRED
359+ #elif defined( SO_PASSCRED )
360360 /*
361361 * Usually Linux systems
362362 */
@@ -406,8 +406,9 @@ init_ipc_auth_data(int sock, size_t len)
406406{
407407 struct ipc_auth_data * data = calloc (1 , sizeof (struct ipc_auth_data ));
408408
409- if (data == NULL )
410- return 0 ;
409+ if (data == NULL ) {
410+ return NULL ;
411+ }
411412
412413 data -> msg_recv .msg_iov = & data -> iov_recv ;
413414 data -> msg_recv .msg_iovlen = 1 ;
@@ -418,7 +419,7 @@ init_ipc_auth_data(int sock, size_t len)
418419 data -> cmsg_cred = calloc (1 , CMSG_SPACE (sizeof (struct ucred )));
419420 if (data -> cmsg_cred == NULL ) {
420421 destroy_ipc_auth_data (data );
421- return 0 ;
422+ return NULL ;
422423 }
423424 data -> msg_recv .msg_control = (void * )data -> cmsg_cred ;
424425 data -> msg_recv .msg_controllen = CMSG_SPACE (sizeof (struct ucred ));
@@ -472,7 +473,7 @@ qb_ipcc_us_setup_connect(struct qb_ipcc_connection *c,
472473 data = init_ipc_auth_data (c -> setup .u .us .sock , sizeof (struct qb_ipc_connection_response ));
473474 if (data == NULL ) {
474475 qb_ipcc_us_sock_close (c -> setup .u .us .sock );
475- return -1 ;
476+ return - ENOMEM ;
476477 }
477478
478479 qb_ipc_us_ready (& c -> setup , NULL , -1 , POLLIN );
@@ -491,17 +492,10 @@ qb_ipcc_us_setup_connect(struct qb_ipcc_connection *c,
491492 memcpy (r , & data -> msg .res , sizeof (struct qb_ipc_connection_response ));
492493
493494 qb_ipc_auth_creds (data );
494- c -> pid = data -> ugp .pid ;
495- c -> euid = data -> ugp .uid ;
496495 c -> egid = data -> ugp .gid ;
497496
498- if (r -> hdr .error != 0 ) {
499- destroy_ipc_auth_data (data );
500- return r -> hdr .error ;
501- }
502-
503497 destroy_ipc_auth_data (data );
504- return 0 ;
498+ return r -> hdr . error ;
505499}
506500
507501/*
0 commit comments