sandbox.c: print the dir on failed chdir(cfg.homedir)

Just like the other nearby error messages for `chdir`.

Relates to #5510.

Suggested-by: @gitsteff
This commit is contained in:
Kelvin M. Klann 2022-12-09 08:08:22 -03:00
parent e52f5e0028
commit f24a49a2c9

View file

@ -1127,8 +1127,10 @@ int sandbox(void* sandbox_arg) {
struct stat s;
if (stat(cfg.homedir, &s) == 0) {
/* coverity[toctou] */
if (chdir(cfg.homedir) < 0)
errExit("chdir");
if (chdir(cfg.homedir) < 0) {
fprintf(stderr, "Error: unable to enter home directory: %s: %s\n", cfg.homedir, strerror(errno));
exit(1);
}
}
}
}