Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kaldrum
SRB2
Commits
74673b8e
Commit
74673b8e
authored
Feb 26, 2024
by
Hanicef
Browse files
Options
Downloads
Patches
Plain Diff
Fix banlist being cleared if server fails to start
parent
908f0962
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/netcode/commands.c
+10
-0
10 additions, 0 deletions
src/netcode/commands.c
with
10 additions
and
0 deletions
src/netcode/commands.c
+
10
−
0
View file @
74673b8e
...
@@ -41,6 +41,8 @@ typedef struct banreason_s
...
@@ -41,6 +41,8 @@ typedef struct banreason_s
static
banreason_t
*
reasontail
=
NULL
;
//last entry, use prev
static
banreason_t
*
reasontail
=
NULL
;
//last entry, use prev
static
banreason_t
*
reasonhead
=
NULL
;
//1st entry, use next
static
banreason_t
*
reasonhead
=
NULL
;
//1st entry, use next
static
boolean
bans_loaded
=
false
;
void
Ban_Add
(
const
char
*
reason
)
void
Ban_Add
(
const
char
*
reason
)
{
{
banreason_t
*
reasonlist
=
malloc
(
sizeof
(
*
reasonlist
));
banreason_t
*
reasonlist
=
malloc
(
sizeof
(
*
reasonlist
));
...
@@ -85,6 +87,8 @@ void Ban_Load_File(boolean warning)
...
@@ -85,6 +87,8 @@ void Ban_Load_File(boolean warning)
if
(
!
I_ClearBans
)
if
(
!
I_ClearBans
)
return
;
return
;
bans_loaded
=
true
;
f
=
fopen
(
va
(
"%s"
PATHSEP
"%s"
,
srb2home
,
"ban.txt"
),
"r"
);
f
=
fopen
(
va
(
"%s"
PATHSEP
"%s"
,
srb2home
,
"ban.txt"
),
"r"
);
if
(
!
f
)
if
(
!
f
)
...
@@ -124,6 +128,12 @@ void D_SaveBan(void)
...
@@ -124,6 +128,12 @@ void D_SaveBan(void)
const
char
*
address
,
*
mask
;
const
char
*
address
,
*
mask
;
const
char
*
path
=
va
(
"%s"
PATHSEP
"%s"
,
srb2home
,
"ban.txt"
);
const
char
*
path
=
va
(
"%s"
PATHSEP
"%s"
,
srb2home
,
"ban.txt"
);
if
(
!
bans_loaded
)
{
// don't save bans if they were never loaded.
return
;
}
if
(
!
reasonhead
)
if
(
!
reasonhead
)
{
{
remove
(
path
);
remove
(
path
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment