From 5c0ceccbc889b9ddc9856b51cecce962306a549f Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 28 May 2007 19:49:20 +0000 Subject: [PATCH] At Scott McKellar's suggestion, using (long) cast and %ld format for getpid() git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@917 9efc2488-bf62-4759-914b-345cdb29e865 --- src/jserver/osrf_chat.c | 2 +- src/libstack/osrf_app_session.c | 2 +- src/libstack/osrf_prefork.c | 4 ++-- src/libtransport/basic_client.c | 4 ++-- src/utils/log.c | 6 +++--- src/utils/socket_bundle.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/jserver/osrf_chat.c b/src/jserver/osrf_chat.c index 55b3c33..235a7e4 100644 --- a/src/jserver/osrf_chat.c +++ b/src/jserver/osrf_chat.c @@ -587,7 +587,7 @@ int osrfChatHandleNewConnection( osrfChatNode* node, const char* name, const xml char* osrfChatMkAuthKey() { char keybuf[112]; bzero(keybuf, 112); - snprintf(keybuf, 111, "%d%d%s", (int) time(NULL), getpid(), getenv("HOSTNAME")); + snprintf(keybuf, 111, "%d%ld%s", (int) time(NULL), (long) getpid(), getenv("HOSTNAME")); return strdup(shahash(keybuf)); } diff --git a/src/libstack/osrf_app_session.c b/src/libstack/osrf_app_session.c index 054ea30..095e50e 100644 --- a/src/libstack/osrf_app_session.c +++ b/src/libstack/osrf_app_session.c @@ -229,7 +229,7 @@ osrf_app_session* osrf_app_client_session_init( char* remote_service ) { char id[256]; memset(id,0,256); - sprintf(id, "%f.%d%d", get_timestamp_millis(), (int)time(NULL), getpid()); + sprintf(id, "%f.%d%ld", get_timestamp_millis(), (int)time(NULL), (long) getpid()); session->session_id = strdup(id); osrfLogDebug( OSRF_LOG_MARK, "Building a new client session with id [%s] [%s]", session->remote_service, session->session_id ); diff --git a/src/libstack/osrf_prefork.c b/src/libstack/osrf_prefork.c index 0a3e54f..1ea5959 100644 --- a/src/libstack/osrf_prefork.c +++ b/src/libstack/osrf_prefork.c @@ -606,8 +606,8 @@ void prefork_child_wait( prefork_child* child ) { buffer_free(gbuf); - osrfLogDebug( OSRF_LOG_MARK, "Child with max-requests=%d, num-served=%d exiting...[%d]", - child->max_requests, i, getpid() ); + osrfLogDebug( OSRF_LOG_MARK, "Child with max-requests=%d, num-served=%d exiting...[%ld]", + child->max_requests, i, (long) getpid() ); osrf_prefork_child_exit(child); /* just to be sure */ } diff --git a/src/libtransport/basic_client.c b/src/libtransport/basic_client.c index d2178eb..d7fa9a1 100644 --- a/src/libtransport/basic_client.c +++ b/src/libtransport/basic_client.c @@ -29,7 +29,7 @@ int main( int argc, char** argv ) { if( (pid=fork()) ) { /* parent */ signal(SIGINT, sig_int); - fprintf(stderr, "Listener: %d\n", getpid() ); + fprintf(stderr, "Listener: %ld\n", (long) getpid() ); char buf[300]; memset(buf, 0, 300); printf("=> "); @@ -56,7 +56,7 @@ int main( int argc, char** argv ) { } else { - fprintf(stderr, "Sender: %d\n", getpid() ); + fprintf(stderr, "Sender: %ld\n", (long) getpid() ); transport_message* recv; while( (recv=client_recv( client, -1)) ) { diff --git a/src/utils/log.c b/src/utils/log.c index 70d1a1f..cac10b0 100644 --- a/src/utils/log.c +++ b/src/utils/log.c @@ -61,7 +61,7 @@ void osrfLogSetIsClient(int is) { /* go ahead and create the xid prefix so it will be consistent later */ static char buff[32]; memset(buff, 0x0, 32); - snprintf(buff, 32, "%d%d", (int)time(NULL), getpid()); + snprintf(buff, 32, "%ld%d", (int)time(NULL), (long) getpid()); __osrfLogXidPfx = buff; } @@ -177,11 +177,11 @@ void _osrfLogDetail( int level, const char* filename, int line, char* msg ) { buf[1533] = '.'; buf[1534] = '.'; buf[1535] = '\0'; - syslog( fac | lvl, "[%s:%d:%s:%d:%s] %s", l, getpid(), filename, line, xid, buf ); + syslog( fac | lvl, "[%s:%ld:%s:%d:%s] %s", l, (long) getpid(), filename, line, xid, buf ); } else if( __osrfLogType == OSRF_LOG_TYPE_FILE ) - _osrfLogToFile("[%s:%d:%s:%d:%s] %s", l, getpid(), filename, line, xid, msg ); + _osrfLogToFile("[%s:%ld:%s:%d:%s] %s", l, (long) getpid(), filename, line, xid, msg ); } diff --git a/src/utils/socket_bundle.c b/src/utils/socket_bundle.c index 5441adf..b966d44 100644 --- a/src/utils/socket_bundle.c +++ b/src/utils/socket_bundle.c @@ -639,7 +639,7 @@ int _socket_handle_client_data(socket_manager* mgr, socket_node* node) { memset(buf, 0, RBUFSIZE); set_fl(sock_fd, O_NONBLOCK); - osrfLogInternal( OSRF_LOG_MARK, "%d : Received data at %f\n", getpid(), get_timestamp_millis()); + osrfLogInternal( OSRF_LOG_MARK, "%ld : Received data at %f\n", (long) getpid(), get_timestamp_millis()); while( (read_bytes = recv(sock_fd, buf, RBUFSIZE-1, 0) ) > 0 ) { osrfLogInternal( OSRF_LOG_MARK, "Socket %d Read %d bytes and data: %s", sock_fd, read_bytes, buf); -- 2.11.0