Skip to content
GitLab
Explore
Sign in
Commits on Source (2)
Create replay files after setuid
· 52df603d
Andrew Price
authored
Sep 17, 2017
52df603d
Don't fsync replay file writes
· 731635f8
Andrew Price
authored
Sep 17, 2017
The data isn't important enough to justify the perf hit
731635f8
Hide whitespace changes
Inline
Side-by-side
src/server/mwserv.c
View file @
731635f8
...
...
@@ -155,8 +155,10 @@ int main(int argc, char **argv)
if
(
err
)
return
err
;
if
(
init_server
()
!=
0
)
if
(
init_server
()
!=
0
)
{
fprintf
(
stderr
,
"Server initialisation failed.
\n
"
);
return
1
;
}
mainsock
=
open_mainsock
(
cfg_get_int
(
"port"
));
...
...
@@ -182,7 +184,10 @@ int main(int argc, char **argv)
}
}
migrate_old_folders
();
if
(
init_server_after_setuid
()
!=
0
)
{
fprintf
(
stderr
,
"Post-setuid setup failed.
\n
"
);
return
1
;
}
if
(
!
cfg_get_bool
(
"debug"
))
{
freopen
(
"/dev/null"
,
"w"
,
stdout
);
freopen
(
"/dev/null"
,
"w"
,
stderr
);
...
...
src/server/replay.c
View file @
731635f8
...
...
@@ -69,7 +69,6 @@ static int write_message(ipc_message_t *msg, unsigned n)
};
if
(
pwritev
(
fd
,
iov
,
2
,
0
)
!=
(
iov
[
0
].
iov_len
+
iov
[
1
].
iov_len
))
perror
(
pathname
);
fsync
(
fd
);
close
(
fd
);
return
0
;
}
...
...
src/server/servsock.c
View file @
731635f8
...
...
@@ -647,7 +647,7 @@ static char *has_suffix(char *str, const char *suffix)
return
NULL
;
}
void
migrate_old_folders
(
void
)
static
void
migrate_old_folders
(
void
)
{
int
dfd
;
DIR
*
dirp
;
...
...
@@ -728,12 +728,18 @@ void migrate_old_folders(void)
}
}
int
init_server
()
int
init_server
(
void
)
{
INIT_LIST_HEAD
(
&
connection_list
);
poll_init
();
return
0
;
}
int
init_server_after_setuid
(
void
)
{
migrate_old_folders
();
if
(
replay_init
()
!=
0
)
return
1
;
poll_init
();
return
0
;
}
...
...
src/server/servsock.h
View file @
731635f8
...
...
@@ -22,8 +22,8 @@ int msg_attach_to_username(ipc_message_t *msg, const char *username);
void
msg_attach_to_channel
(
ipc_message_t
*
msg
,
int
channel
,
const
char
*
exclude
);
void
msg_attach_to_perm
(
ipc_message_t
*
msg
,
perm_t
perm
);
void
msg_attach
(
ipc_message_t
*
msg
,
ipc_connection_t
*
conn
);
void
migrate_old_folders
(
void
);
int
init_server
(
void
);
int
init_server_after_setuid
(
void
);
void
send_error
(
ipc_connection_t
*
conn
,
ipc_message_t
*
orig
,
const
char
*
format
,
...);
void
msg_apply_gag
(
struct
user
*
from
,
ipc_message_t
*
msg
,
const
char
*
field
);
ipc_message_t
*
msg_wholist
(
void
);
...
...