@@ -269,7 +269,11 @@ service_init(struct service_pool *p, service_id id, void *ud, size_t sz, void *p
269269 assert (S != NULL && S -> L == NULL && S -> status == SERVICE_STATUS_UNINITIALIZED );
270270 lua_State * L ;
271271 memset (& S -> stat , 0 , sizeof (S -> stat ));
272+ #if LUA_VERSION_NUM == 505
273+ L = lua_newstate (service_alloc , & S -> stat , luaL_makeseed (NULL ));
274+ #else
272275 L = lua_newstate (service_alloc , & S -> stat );
276+ #endif
273277 if (L == NULL )
274278 return 1 ;
275279 lua_pushcfunction (L , init_service );
@@ -394,6 +398,9 @@ service_loadstring(struct service_pool *p, service_id id, const char *source, si
394398 return NULL ;
395399}
396400
401+ #define writestringerror (s ,p ) \
402+ (fprintf(stderr, (s), (p)), fflush(stderr))
403+
397404int
398405service_resume (struct service_pool * p , service_id id ) {
399406 struct service * S = get_service (p , id );
@@ -416,13 +423,13 @@ service_resume(struct service_pool *p, service_id id) {
416423 return 1 ;
417424 }
418425 if (!lua_checkstack (L , LUA_MINSTACK )) {
419- lua_writestringerror ("%s\n" , lua_tostring (L , -1 ));
426+ writestringerror ("%s\n" , lua_tostring (L , -1 ));
420427 lua_pop (L , 1 );
421428 return 1 ;
422429 }
423430 lua_pushfstring (L , "Service %d error: %s" , id .id , lua_tostring (L , -1 ));
424431 luaL_traceback (L , L , lua_tostring (L , -1 ), 0 );
425- lua_writestringerror ("%s\n" , lua_tostring (L , -1 ));
432+ writestringerror ("%s\n" , lua_tostring (L , -1 ));
426433 lua_pop (L , 3 );
427434 return 1 ;
428435}
0 commit comments