mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 16:57:00 +08:00
main: Check chdir() return value
This fixes:
main.c: In function ‘main’:
main.c:1025:8: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Wunused-result]
chdir(s->config->chroot_dir);
^
This commit is contained in:
committed by
Nikos Mavrogiannopoulos
parent
fbe55c23ef
commit
1545130237
@@ -1019,8 +1019,13 @@ int main(int argc, char** argv)
|
||||
|
||||
/* chdir to our chroot directory, to allow opening the sec-mod
|
||||
* socket if necessary. */
|
||||
if (s->config->chroot_dir)
|
||||
chdir(s->config->chroot_dir);
|
||||
if (s->config->chroot_dir) {
|
||||
if (chdir(s->config->chroot_dir) != 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "cannot chdir to %s: %s", s->config->chroot_dir, strerror(e));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
ms_sleep(100); /* give some time for sec-mod to initialize */
|
||||
|
||||
/* Initialize certificates */
|
||||
|
||||
Reference in New Issue
Block a user