@@ -269,7 +269,11 @@ service_init(struct service_pool *p, service_id id, void *ud, size_t sz, void *p
269
269
assert (S != NULL && S -> L == NULL && S -> status == SERVICE_STATUS_UNINITIALIZED );
270
270
lua_State * L ;
271
271
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
272
275
L = lua_newstate (service_alloc , & S -> stat );
276
+ #endif
273
277
if (L == NULL )
274
278
return 1 ;
275
279
lua_pushcfunction (L , init_service );
@@ -394,6 +398,9 @@ service_loadstring(struct service_pool *p, service_id id, const char *source, si
394
398
return NULL ;
395
399
}
396
400
401
+ #define writestringerror (s ,p ) \
402
+ (fprintf(stderr, (s), (p)), fflush(stderr))
403
+
397
404
int
398
405
service_resume (struct service_pool * p , service_id id ) {
399
406
struct service * S = get_service (p , id );
@@ -416,13 +423,13 @@ service_resume(struct service_pool *p, service_id id) {
416
423
return 1 ;
417
424
}
418
425
if (!lua_checkstack (L , LUA_MINSTACK )) {
419
- lua_writestringerror ("%s\n" , lua_tostring (L , -1 ));
426
+ writestringerror ("%s\n" , lua_tostring (L , -1 ));
420
427
lua_pop (L , 1 );
421
428
return 1 ;
422
429
}
423
430
lua_pushfstring (L , "Service %d error: %s" , id .id , lua_tostring (L , -1 ));
424
431
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 ));
426
433
lua_pop (L , 3 );
427
434
return 1 ;
428
435
}
0 commit comments