printf(
" dispense refund <user> <itemid> [<price>]\n"
" Refund an item to a user (with optional price override)\n"
+ " Item IDs can be seen in the cokelog (in the brackets after the item name)\n"
+ " e.g. coke:6 for a coke, snack:33 for slot 33 of the snack machine\n"
);
if( giTextArgc == 0 || strcmp(gsTextArgs[0], "slot") == 0 )
printf(
ret = handler->DoDispense( User, Item->ID );
if(ret) {
Log_Error("Dispense failed (%s dispensing %s:%i '%s')",
- username, Item->Name, Item->Handler->Name, Item->ID);
+ username, Item->Handler->Name, Item->ID, Item->Name);
free( username );
return -1; // 1: Unknown Error again
}
// Fork into background
if( gbServer_RunInBackground )
{
- int newin, newout, newerr;
int pid = fork();
if( pid == -1 ) {
fprintf(stderr, "ERROR: Unable to fork\n");
}
// In child
// - Sort out stdin/stdout
- newin = open("/dev/null", O_RDONLY);
- newout = open(gsServer_LogFile, O_CREAT|O_APPEND, 0644);
- newerr = open(gsServer_ErrorLog, O_CREAT|O_APPEND, 0644);
- dup2(newin, 0);
- dup2(newout, 1);
- dup2(newerr, 2);
+ dup2( open("/dev/null", O_RDONLY, 0644), STDIN_FILENO );
+ dup2( open(gsServer_LogFile, O_CREAT|O_APPEND, 0644), STDOUT_FILENO );
+ dup2( open(gsServer_ErrorLog, O_CREAT|O_APPEND, 0644), STDERR_FILENO );
}
// Start the helper thread