diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/port.h | 6 | ||||
-rw-r--r-- | src/worker.c | 8 |
2 files changed, 12 insertions, 2 deletions
@@ -37,4 +37,10 @@ typedef unsigned char _Bool; #define PORT_DIR_SEPARATOR '/' #endif +#ifdef _WIN32 +#define PRIgid "%p" +#else +#define PRIgid "%d" +#endif + #endif diff --git a/src/worker.c b/src/worker.c index 3bebd60..bcf01f3 100644 --- a/src/worker.c +++ b/src/worker.c @@ -116,7 +116,9 @@ static char *create_worker_termination_answer( const char *name, GPid pid ) json_object *name_obj = json_object_new_string( name ); json_object_object_add( obj, "worker", name_obj ); - json_object *pid_obj = json_object_new_int( pid ); + char pid_str[64]; + snprintf( pid_str, sizeof( pid_str ), PRIgid, pid ); + json_object *pid_obj = json_object_new_string( pid_str ); json_object_object_add( obj, "pid", pid_obj ); time_t ts; @@ -146,7 +148,9 @@ static char *create_worker_created_answer( const char *name, GPid pid ) json_object *name_obj = json_object_new_string( name ); json_object_object_add( obj, "worker", name_obj ); - json_object *pid_obj = json_object_new_int( pid ); + char pid_str[64]; + snprintf( pid_str, sizeof( pid_str ), PRIgid, pid ); + json_object *pid_obj = json_object_new_string( pid_str ); json_object_object_add( obj, "pid", pid_obj ); time_t ts; |