Linux problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Linux problem (
/showthread.php?tid=502326)
Linux problem -
FaZeRs - 23.03.2014
So server is shutting down all time and i got in console
Quote:
samp03svr: amx/amxfile.c:222: fputs_cell: Assertion `fp!=((void *)0)' failed.
|
I have set all scriptfiles chmod 777
Re: Linux problem -
Konstantinos - 23.03.2014
http://dracoblue.net/dev/amxamxfilec...-in-fputscell/
Re: Linux problem -
FaZeRs - 23.03.2014
But before few days i didnt have this problem, and then just randomly server started to shutdown. And i have set all directories writeable
Re: Linux problem -
Konstantinos - 23.03.2014
Dracoblue also mentioned to check if the file handle is valid when you open a file before using an invalid file handle in any some functions. For example if you use an invalid file handle in fread/fwrite/fclose, it can crash the server. Other than that, I don't know what could cause it.
Re: Linux problem -
FaZeRs - 23.03.2014
Is there some way to find which of those file handles is incorrect?
Re: Linux problem -
Arjanz - 23.03.2014
Some files u uploaded might be corrupted, happedned to me but it got fixed when i uploaded a few files again
Re: Linux problem -
Konstantinos - 23.03.2014
You can prevent them through the scripts.
An example:
pawn Код:
new
File: fhandle = fopen(...);
if (fhandle) // Valid file handle
{
// code.. you can read from/write to the file
fclose(fhandle);
}
Re: Linux problem -
FaZeRs - 23.03.2014
I have that
Quote:
LoadHouses() {
if(!fexist("apartments.cfg")) return 1;
new
szFileStr[1024],
File: iFileHandle = fopen("apartments.cfg", io_read),
iIndex;
while(iIndex < sizeof(HouseInfo) && fread(iFileHandle, szFileStr)) {
sscanf(szFileStr, "p<|>iiis[128]s[24]ffffffffiiiiiiiiiiiiiiiiiiffiiiiiiiiiii",
|
It started after i changed house config file.
Quote:
SaveHouses() {
new
szFileStr[1024],
File: fHandle = fopen("apartments.cfg", io_write);
for(new iIndex; iIndex < MAX_HOUSES; iIndex++) {
format(szFileStr, sizeof(szFileStr), "%d|%d|%d|%s|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|% d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f| %d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\r\n",
|
Config line
Quote:
0|0|0||Nobody|0.000000|0.000000|-500.000000|0.000000|0.000000|0.000000|0.000000|0.0 00000|1|0|0|0|0|0|0|0|0|0|0|0|0|1|1582|1162|0|0|0. 000000|0.000000|0|0|0|0|0|0|0|0|0|0|0
|
Re: Linux problem -
Konstantinos - 23.03.2014
Valid file handle means if the file was opened successfully, not if it exists.
You haven't checked for both (even though in the SaveHouses you haven't posted the part that writes).
pawn Код:
LoadHouses()
{
if(!fexist("apartments.cfg")) return 1;
new
szFileStr[1024],
File: iFileHandle = fopen("apartments.cfg", io_read),
iIndex;
if (iFileHandle) // valid handle
{
while(iIndex < sizeof(HouseInfo) && fread(iFileHandle, szFileStr))
{
sscanf(...);
// may some other code..
iIndex++;
}
fclose(iFileHandle);
}
return 1;
}
pawn Код:
SaveHouses()
{
new
szFileStr[1024],
File: fHandle = fopen("apartments.cfg", io_write);
if (fHandle) // valid handle
{
for(new iIndex; iIndex < MAX_HOUSES; iIndex++)
{
format(...);
fwrite(fHandle, szFileStr);
}
fclose(fHandle);
}
...
return 1;
}
Re: Linux problem -
FaZeRs - 23.03.2014
Still the same
Quote:
samp03svr: amx/amxfile.c:222: fputs_cell: Assertion `fp!=((void *)0)' failed.
|