Browse Source

MT#55283 Execute chmod and chown operations ...

... after file is opened

- Relocated chmod and chown operations from output_shutdown to output_config.
- Ensures file permissions and ownership are set immediately after file is opened.

Closes #1853

Change-Id: I1b60ce73fc44c9ac91400e7a234c30a697c48fcb
pull/1855/head
Joey Golan 1 year ago
committed by Richard Fuchs
parent
commit
9edc014f20
1 changed files with 10 additions and 8 deletions
  1. +10
    -8
      recording-daemon/output.c

+ 10
- 8
recording-daemon/output.c View File

@ -341,6 +341,16 @@ got_fn:
if (av_ret)
goto err;
if (output_chmod)
if (chmod(output->filename, output_chmod))
ilog(LOG_WARN, "Failed to change file mode of '%s%s%s': %s",
FMT_M(output->filename), strerror(errno));
if (output_chown != -1 || output_chgrp != -1)
if (chown(output->filename, output_chown, output_chgrp))
ilog(LOG_WARN, "Failed to change file owner/group of '%s%s%s': %s",
FMT_M(output->filename), strerror(errno));
if (flush_packets) {
output->fmtctx->flags |= AVFMT_FLAG_FLUSH_PACKETS;
}
@ -374,14 +384,6 @@ static bool output_shutdown(output_t *output) {
av_write_trailer(output->fmtctx);
avio_closep(&output->fmtctx->pb);
ret = true;
if (output_chmod)
if (chmod(output->filename, output_chmod))
ilog(LOG_WARN, "Failed to change file mode of '%s%s%s': %s",
FMT_M(output->filename), strerror(errno));
if (output_chown != -1 || output_chgrp != -1)
if (chown(output->filename, output_chown, output_chgrp))
ilog(LOG_WARN, "Failed to change file owner/group of '%s%s%s': %s",
FMT_M(output->filename), strerror(errno));
}
avformat_free_context(output->fmtctx);


Loading…
Cancel
Save