swtpm: Do not chdir(/) when using --daemon

With relative paths being used the chdir("/") in daemonize_finish() will
cause file access errors.

Fixes: 98d1d12 ("swtpm: Make --daemon not racy")
Resolves: https://github.com/stefanberger/swtpm/issues/671
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2022-03-03 09:13:26 -05:00 committed by Stefan Berger
parent 8a05e8fd52
commit 646cf413b1

View File

@ -274,12 +274,6 @@ daemonize_finish(void)
return;
}
if (chdir("/") == -1) {
fprintf(stderr, "Failed to change directory to /: %s\n",
strerror(errno));
fflush(stderr);
exit(1);
}
if (dup2(devnullfd, STDOUT_FILENO) == -1) {
fprintf(stderr, "Failed to redirect output stream to /dev/null: %s\n",
strerror(errno));