Skip to content

Commit

Permalink
Log in other places here when stat(2)/fstat(2) fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjsaunders committed Oct 19, 2014
1 parent 4ab33ed commit 8ddfc52
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions contrib/mod_sftp/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ int sftp_misc_chown_file(pr_fh_t *fh) {
(unsigned long) session.fsgid);

pr_fs_clear_cache();
pr_fsio_fstat(fh, &st);
if (pr_fsio_fstat(fh, &st) < 0) {
pr_log_debug(DEBUG0,
"'%s' fstat(2) error for %sfchmod: %s", fh->fh_path,
use_root_privs ? "root " : "", strerror(errno));
}

if (use_root_privs) {
PRIVS_ROOT
Expand Down Expand Up @@ -189,7 +193,11 @@ int sftp_misc_chown_path(const char *path) {
}

pr_fs_clear_cache();
pr_fsio_stat(path, &st);
if (pr_fsio_stat(path, &st) < 0) {
pr_log_debug(DEBUG0,
"'%s' stat(2) error for root chmod: %s", fh->fh_path,
strerror(errno));
}

/* The chmod happens after the chown because chown will remove the
* S{U,G}ID bits on some files (namely, directories); the subsequent
Expand Down

0 comments on commit 8ddfc52

Please sign in to comment.